View Single Post
Old 08-31-2010, 12:46 PM   #2577
buyo
Junior Member
buyo began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2010
Device: Kindle 3
hi, i've been lurking around for a while but figured i probably should participate. first off, i want to say that i think calibre is a wonderful program and thanks to all the ppl who created all the great recipes.

i created a small recipe of my hometown newspaper, The Winnipeg Free Press (http://www.winnipegfreepress.com), that seems to work well for me so i thought i'd share it here. i'm a total noob when it comes to python so please forgive the roughness of the code.

Spoiler:
Code:
class WinnipegFreePress(BasicNewsRecipe):
    title          = u'Winnipeg Free Press'
    __author__            = 'buyo'
    description           = 'News from Winnipeg, Manitoba, Canada'
    oldest_article = 1
    max_articles_per_feed = 15
    category              = 'News, Winnipeg, Canada'
    cover_url             = 'http://media.winnipegfreepress.com/designimages/winnipegfreepress_WFP.gif'
    no_stylesheets        = True
    encoding              = 'UTF-8'
    remove_javascript     = True
    use_embedded_content  = False
    language = 'en_CA'

    feeds          = [(u'Breaking News', u'http://www.winnipegfreepress.com/rss?path=/breakingnews'),
	      (u'Local News',u'http://www.winnipegfreepress.com/rss?path=/local'),
	      (u'Breaking Business News',u'http://www.winnipegfreepress.com/rss?path=/business/finance'),
	      (u'Business',u'http://www.winnipegfreepress.com/rss?path=/business'),
	      (u'Editorials',u'http://www.winnipegfreepress.com/rss?path=/opinion/editorials'),
	      (u'Views from the West',u'http://www.winnipegfreepress.com/rss?path=/opinion/westview'),
	      (u'Life & Style',u'http://www.winnipegfreepress.com/rss?path=/life'),
	      (u'Food & Drink',u'http://www.winnipegfreepress.com/rss?path=/life/food')
	     ]

    keep_only_tags = [
	          dict(name='div', attrs={'id':'article_header'}),
                              dict(name='div', attrs={'class':'article'}),
                              ]


i'm also working on a recipe for my favourite gossip site *blush* (http://www2.laineygossip.com/). while i've managed to get the articles just fine, i can't seem to get it to show the thumbnail images at the bottom... i was wondering if someone could give me some advice on this? I'd greatly appreciate it!

Spoiler:
Code:
class AdvancedUserRecipe1283190045(BasicNewsRecipe):
    title          = u'Lainey Gossip2'
    cover_url             = 'http://www2.laineygossip.com/i/logo_header.gif'
    oldest_article = 1
    max_articles_per_feed = 10
    language = 'en'
    no_stylesheets  = True

    feeds          = [(u'Lainey Gossip', u'http://www.laineygossip.com/LaineyGossipRss.ashx')]

    keep_only_tags = [
	            dict(name='div', attrs={'id':['mainContent']}),
                              ]
    remove_tags = [
	       dict(name='div', attrs={'class':['articlefooter','articlerelated','articlenavright']}),
	       dict(name='p', attrs={'class':['footer']}),
  	      ]
buyo is offline