Parse MediaRSS with ASP - Posted (867 Views)
Senior Member
Astralis
Posts: 1218
1218
I'm stuck on two things:

1) How to obtain the media nodes within the media:group node. 2) How to obtain the url within the enclosure 'node'

Here is the concept if you follow the rss_url in the code below:

Code:
<item>
<enclosure type="image/jpg" url="http://etc...">
<media:group>
<media:content>
Some content here... </media:content>
</media:group>
</item>

Here is the basic script I'm using to obtain most of the information:

BTW, I know I'm doing it wrong to grab MEDIA:X -- I just don't know how to do it:

Code:

<%
rss_url = "http://picasaweb.google.com/data/feed/base/user/astralislux/albumid/5337515226926954881?alt=rss&kind=photo&hl=en_US"
Set xml = Server.CreateObject("msxml2.ServerXMLHTTP")

xml.open "GET", rss_url, False
xml.send

Set doc = Server.CreateObject("msxml2.DOMDocument")
doc.loadXML( xml.ResponseText )

Set items = doc.getElementsByTagName("item")
Response.Write items.length & "<HR>"

Dim curitme
For inum = 0 To items.length-1
Set curitem = items.item(inum)
title = getNode("title")
description = getNode("description")
thumbnail = getNode("thumbnail")
enclosure = getNode("enclosure")

Response.Write title & "<br />" & description & "<br />" & thumbnail & "<br>" & enclosure & "<hr>" & vbNewLine
Next 'Go through each link in the rss feed.
Function getNode(name)
dim node
Set node = curitem.SelectSingleNode(name)
If node IS NOTHING Then getNode = "[no " & name & "]" Else getNode = node.Text
End Function

%>

No replies

You Must enter a message