Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2008
    Location
    Scotland
    Posts
    41
    Thanks
    12
    Thanked 1 Time in 1 Post

    modify pyton script to parse rss

    I use this script: http://leecher.pastebin.com/f197a7770 (from this http://code.google.com/p/leechr/ )

    Basically it searches myepisodes.com for what programmes I watch, and then uses that search criteria to download .nzb files from newzleech.com (it doesnt actually download any tv shows, just .nzb files which are just xml information files)

    But its been broken for some time now - the way it searches newzleech.com is just to append the search string to the rss part of their page, which no longer works. I was looking to change the code so instead it would parse a proper rss feed (eg: http://www.tvnzb.com/tvnzb_new.rss )for the search string..

    Ive come up with this snippet:

    Code:
    import feedparser
    d = feedparser.parse("http://www.tvnzb.com/tvnzb_new.rss")
    for entry in d['entries']:
    	if entry['title'] == "INSERT MYEPS EP HERE":
    		goGetTheURL(entry['link'])
    But Im not really sure how to change the existing code to incorporate it..

    Any pointers would be much appreciated...

  • #2
    Regular Coder Samhain13's Avatar
    Join Date
    Aug 2008
    Location
    Pilipinas
    Posts
    169
    Thanks
    4
    Thanked 18 Times in 18 Posts
    Simple hack. Maybe there's a better way?
    Code:
    import feedparser
    
    # List of the titles you're interested in.
    my_eps = ["Something"]
    
    d = feedparser.parse("http://www.tvnzb.com/tvnzb_new.rss")
    for entry in d['entries']:
            # Old if.
    	# if entry['title'] == "INSERT MYEPS EP HERE":
            # New if. Look for the entry title in your list of titles.
            if entry["title"] in my_eps:
    		goGetTheURL(entry['link'])
    I am a Man of Truth. I am a Free Human Person. I am a Peacemaker.
    ** Independent Multimedia Artist in Pasig **


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •