View Single Post
Old 10-15-2009, 05:06 PM   #820
CABITSS
Member
CABITSS began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Sep 2009
Device: amazonkindle
Quote:
Originally Posted by kiklop74 View Post
New recipe for Toronto Sun:
Thanks a ton for your helping me clean up my recipe.... this works well.... I have added a few more links to the recipe
How to I add a Gold Star to your ID.... Keep up the GOOD WORK.... we all do appreciate it.

.......

#!/usr/bin/env python

__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
www.torontosun.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class TorontoSun(BasicNewsRecipe):
title = 'Toronto SUN'
__author__ = 'Darko Miletic'
description = 'News from Canada'
publisher = 'Toronto Sun'
category = 'news, politics, Canada'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'cp1252'
language = 'en_CA'

conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}

keep_only_tags =[
dict(name='div', attrs={'class':'articleHead'})
,dict(name='div', attrs={'id':'channelContent'})
]
remove_tags = [
dict(name='div',attrs={'class':['leftBox','bottomBox clear','bottomBox','breadCrumb']})
,dict(name=['link','iframe','object'])
,dict(name='a',attrs={'rel':'swap'})
,dict(name='ul',attrs={'class':'tabs dl contentSwap'})
]

remove_tags_after = dict(name='div',attrs={'class':'bottomBox clear'})

feeds = [
(u'News' , u'http://www.torontosun.com/news/rss.xml' )
,(u'Canada' , u'http://www.torontosun.com/news/canada/rss.xml' )
,(u'Toronto & GTA' ,u'http://www.torontosun.com/news/torontoandgta/rss.xml')
,(u'Sports' ,u'http://www.torontosun.com/sports/rss.xml')
,(u'World' , u'http://www.torontosun.com/news/world/rss.xml' )
,(u'Money' , u'http://www.torontosun.com/money/rss.xml' )
,(u'Life' ,u'http://www.torontosun.com/life/rss.xml')
,(u'Columnists' , u'http://www.torontosun.com/news/columnists/rss.xml')
,(u'Travel' ,u'http://www.torontosun.com/travel/rss.xml' )
]
..............
CABITSS is offline