The following seems to work, but is not elegant:
Code
alias _rssfin {
  if (($1 isnum) && ($urlget($1).state == ok)) {
    if ($com(a)) .comclose a
    .comopen a MSXML2.DOMDocument.6.0
    if ($comerr) goto error
    echo -ag Load into XML (slurp): $com(a,LoadXML,3,&bstr, &slurp) - $com(a).result
    if ($com(b)) .comclose b
    echo -ag selectNodes: $com(a,selectNodes,3,bstr,//item,dispatch* b)
    if ($comerr) goto error
    var %n $comval(b,0,selectNodes), %i 1
    while (%i <= %n) {
      ;echo -ag $comval(b,%i,xml)
      if ($com(c)) .comclose c
      .comopen c MSXML2.DOMDocument.6.0
      if ($comerr) goto error
      echo -ag Load into XML ($!com): $com(c,LoadXML,3,bstr, $comval(b,%i,xml)) - $com(a).result
      if ($com(d)) .comclose d
      echo -ag Title: $com(c,selectNodes,3,bstr,//title,dispatch* d)
      if ($comerr) goto error
      echo -ag $comval(d,1,text)
      if ($com(d)) .comclose d
      echo -ag Link: $com(c,selectNodes,3,bstr,//link,dispatch* d)
      if ($comerr) goto error
      echo -ag $comval(d,1,text)
      if ($com(d)) .comclose d
      echo -ag pubDate: $com(c,selectNodes,3,bstr,//pubDate,dispatch* d)
      echo -ag $comval(d,1,text)       
      if ($com(d)) .comclose d
      inc %i
    }
    :error
    if ($com(a)) .comclose a
    if ($com(b)) .comclose b
    if ($com(c)) .comclose c
    if ($com(d)) .comclose d
  }
}
; https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url
alias _rssget {
  var %pattern https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
  if (!$regex($1,%pattern)) echo 4 Invalid URL
  else noop $urlget($1-,gb,&slurp,_rssfin)
}



Code
/_rssget https://www.volkskrant.nl/voorpagina/rss.xml

Last edited by kap; 07/04/20 05:09 PM.

GNU Terry Pratchett - Looking for a mIRC help channel -> Check #mircscripting @ irc.swiftirc.net