View Single Post
Old 12-29-2009, 02:56 AM   #1033
jimmypatrick
Member
jimmypatrick began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Dec 2009
Location: Cupertino, CA
Device: Kindle 2, iPad
The Independent (UK)

I didn't see a recipe for the Independent. (My first recipe, so if any recipe hackers want to take a look and let me know if I've made any blunders.)

It looks good on my new Kindle, but let me know if it doesn't work on your device.

Code:
class AdvancedUserRecipe1262062929(BasicNewsRecipe):
    title          = u'The Independent'
    oldest_article = 1
    max_articles_per_feed = 100

    feeds          = [(u'UK', u'http://www.independent.co.uk/news/uk/rss'), 
                      (u'World', u'http://www.independent.co.uk/news/world/rss'), 
                      (u'Sport', u'http://www.independent.co.uk/sport/rss'),
                      (u'Arts & Entertainment', u'http://www.independent.co.uk/arts-entertainment/rss'),
                      (u'Life & Style',u'http://www.independent.co.uk/life-style/fashion/news/rss'),
                      (u'Business',u'http://www.independent.co.uk/news/business/rss'),
                      (u'Science',u'http://www.independent.co.uk/news/science/rss'),
                      (u'Media',u'http://www.independent.co.uk/news/media/rss')
                      ]

    keep_only_tags = [dict(id=['article'])]
    remove_tags = [dict(name='div', attrs={'class':'share-links'}),
                   dict(name='ul', attrs={'class':'article-tools'}),
                   dict(name='div', attrs={'class':'related-articles'})
                  ]
    
    extra_css = "body{color:black;}"
I also don't know how to grab the attributes out of the "basic recipe" panel to fill up objects like "oldest article" and "max_articles_per_feed".

I've grabbed most of the feeds here, but you can cut them out if you just want "UK" or "Business"

--

Jimmy
jimmypatrick is offline