Thread: rss feeder

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    49
    Rep Power
    11

    rss feeder


    hi,

    i am supposed to make a rss feeder, where should i start?? have anybody any code examples???

    thanks

    ain
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Norway
    Posts
    41
    Rep Power
    12
    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))
    Good web hosting info - articles about web hosting
    hb's web dev blog
  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Perhaps a google for python rss py

    grim
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Norway
    Posts
    41
    Rep Power
    12
    I think that Universal Feed Parser is worth mentioning too.
    Good web hosting info - articles about web hosting
    hb's web dev blog
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Wow, why didn't this come up in my search on google . Thanks for the link!
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo