JavaScript - Leer RSS de wordpress mediante JavaScript

 
Vista:

Leer RSS de wordpress mediante JavaScript

Publicado por Joseba (1 intervención) el 18/01/2012 14:02:31
Necesito poder leer un feed de wordpress mediante JavaScript.
El RSS está en buscolook.wordpress.com/feed
Tengo el código siguiente que me permite acceder a ciertas etiquetas como 'title', 'link', 'description' pero no se como puedo acceder a cualquiera de las imágenes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
' change the RSSURL variable to the exact URL of the RSS Feed you want to pull
RSSURL = "http://buscolook.wordpress.com/feed"

Dim objHTTP ' this object is used to call the RSS Feed remotely
Dim RSSURL,RSSFeed ' these variables hold the URL and Content for the RSS Feed
Dim xmlRSSFeed ' this variable hold the XML data in a DOM Object
Dim objItems,objItem, objChild ' these variables are used to temporarily hold data from the various RSS Items
Dim title,description,link, imagen '  these are local variables that will hold the data to be displayed
Dim OutputHTML_1,OutputHTML_2,OutputHTML_3 ' these variables will hold the HTML that was converted from the RSS Feed

' this code requests the raw RSS/XML and saves the response as a string <RSSFeed>
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.open "GET",RSSURL,false
objHTTP.send
RSSFeed = objHTTP.responseText
 
' this code takes the raw RSSFeed and loads it into an XML Object
Set xmlRSSFeed = Server.CreateObject("MSXML2.DomDocument.4.0")
xmlRSSFeed.async = false
xmlRSSFeed.LoadXml(RSSFeed)

' this code disposes of the object we called the feed with
Set objHTTP = Nothing
 
' this is where you determine how to display the content from the RSS Feed

' this code grabs all the "items" in the RSS Feed
Set objItems = xmlRSSFeed.getElementsByTagName("item")
 
' this code disposes of the XML object that contained the entire feed
Set xmlRSSFeed = Nothing

' loop over all the items in the RSS Feed
For x = 0 to objItems.length - 1
	' this code places the content from the various RSS nodes into local variables
	Set objItem = objItems.item(x)
	For Each objChild in objItem.childNodes
		Select Case LCase(objChild.nodeName)
			Case "title"
					titulo = objChild.text
			Case "link"
					link = objChild.text
			Case "description"
					description = objChild.text
		End Select
	Next
	' Here are some various display samples.
	OutputHTML_1 = OutputHTML_1 & "<a href=""" & link & """>" & title & "</a><br />" & description & " " & imagen & " " & fecha & "<br /><br />"
	OutputHTML_2 = OutputHTML_2 & "<a href=""" & link & """>" & title & "</a><br />"
	OutputHTML_3 = OutputHTML_3 & "<a href=""" & link & """>" & title & "</a><hr />"
Next

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder