Я надеялся, что на этот вопрос ответили годами, но это не так.Я пытаюсь проанализировать RSS-каналы Reddit, используя классический ASP, но я не могу разобрать поток.Я могу загрузить его, но для меня это пока невозможно.
Я пытаюсь проанализировать любой RSS-канал, такой как https://www.reddit.com/r/worldnews.rss
.скрипт:
rss_url ="https://www.reddit.com/r/worldnews.rss"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
Err.Clear ' shouldn't be needed; can't hurt
'ON ERROR RESUME NEXT
xml.open "GET", rss_url, False
xml.send
'ON ERROR GOTO 0
If Err.Number <> 0 Then
Response.Write "NO feed from ..."
Else
ResponseXML = xml.responseText
'response.write "<hr>"&ResponseXML&"<hr>"
Set doc = Server.CreateObject("Microsoft.DOMDocument")
doc.loadXML( xml.ResponseXML.xml )
Set items = doc.getElementsByTagName("entry")
For inum = 0 To items.length-1
Set curitem = items.entry(inum)
title = Replace( curitem.SelectSingleNode("title").text, "'", "''" )
content = Replace( curitem.SelectSingleNode("content").text, "'", "''" )
Set linkNode = curitem.SelectSingleNode("link")
If linkNode Is Nothing Then
link = "**NONE**" ' if no description given, supply this
Else
link = Replace( linkNode.text, "'", "''" )
End If
'link = Replace( curitem.SelectSingleNode("link").text, "'", "''" )
Set descNode = curitem.SelectSingleNode("description")
If descNode Is Nothing Then
description = "**NONE**" ' if no description given, supply this
Else
description = Replace( descNode.text, "'", "''" )
End If
response.write "<strong>"& title & "</strong><br>"& description &"<br>"& content &"<br>"& link &"<hr><br><br>"
Next
Фид загружен, но я не думаю, что он загружается в DOM.Я не уверен, что не так.