|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
rss feeder
hi,
i am supposed to make a rss feeder, where should i start?? have anybody any code examples??? thanks ain |
|
#2
|
|||
|
|||
|
Not sure if you mean to create an rss feed or parse an rss feed. Anyway it's not too hard with the xml functionality in the standard library. The xml.dom.minidom package is a good start.
Alternatively, use the excellent ElementTree module. If rss.xml is an RSS 1.0 file this code should store the urls and titles of the items in the rss file as a list of (url, title) tuples. Code:
import xml.dom.minidom
rssfile = "rss.xml"
buffer = []
doc = xml.dom.minidom.parse(rssfile)
items = doc.getElementsByTagName("item")
for item in items:
link = item.getElementsByTagName("link")[0]
url = str(link.firstChild.data.strip())
title = item.getElementsByTagName("title")[0]
title = str(title.firstChild.data.strip())
buffer.append((url, title))
|
|
#3
|
||||
|
||||
|
Perhaps a google for python rss py
grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#4
|
||||
|
||||
|
Maybe worth mentioning: Pythons current RSS offerings don't work on Windows since they seem to be using *nix only features - Specifically Mark Nottinghams RSS.py
![]() Mark. |
|
#5
|
|||
|
|||
|
I think that Universal Feed Parser is worth mentioning too.
|
|
#6
|
||||
|
||||
|
Wow, why didn't this come up in my search on google
. Thanks for the link! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > rss feeder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|