Fix #3728 (Updated recipe for The Toronto Star)

This commit is contained in:
Kovid Goyal 2009-10-08 14:51:48 -06:00
parent dc58e890bf
commit 9848c1ec4b

View File

@ -1,47 +1,49 @@
#!/usr/bin/env python #!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.thestar.com www.thestar.com
''' '''
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class TheTorontoStar(BasicNewsRecipe): class TheTorontoStar(BasicNewsRecipe):
title = 'The Toronto Star' title = 'The Toronto Star'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic'
description = "Canada's largest daily newspaper" description = "Canada's largest daily newspaper"
oldest_article = 2 oldest_article = 2
language = 'en_CA' language = 'en_CA'
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
publisher = 'The Toronto Star' delay = 2
category = "Toronto Star,Canada's largest daily newspaper,breaking news,classifieds,careers,GTA,Toronto Maple Leafs,sports,Toronto,news,editorial,The Star,Ontario,information,columnists,business,entertainment,births,deaths,automotive,rentals,weather,archives,Torstar,technology,Joseph Atkinson" publisher = 'The Toronto Star'
encoding = 'utf-8' category = "Toronto Star,Canada's largest daily newspaper,breaking news,classifieds,careers,GTA,Toronto Maple Leafs,sports,Toronto,news,editorial,The Star,Ontario,information,columnists,business,entertainment,births,deaths,automotive,rentals,weather,archives,Torstar,technology,Joseph Atkinson"
extra_css = ' .headlineArticle{font-size: x-large; font-weight: bold} .navbar{text-align:center} ' encoding = 'utf-8'
conversion_options = { conversion_options = {
'comments' : description 'comments' : description
,'tags' : category ,'tags' : category
,'publisher' : publisher ,'publisher' : publisher
} }
keep_only_tags = [dict(name='div', attrs={'id':'AssetWebPart1'})] keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})]
remove_attributes= ['style'] remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'})
feeds = [ feeds = [
(u'News' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' ) (u'News' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' )
,(u'Opinions' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=311' ) ,(u'Opinions' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=311' )
,(u'Business' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=294' ) ,(u'Business' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=294' )
,(u'Sports' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=295' ) ,(u'Sports' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=295' )
,(u'Entertainment', u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' ) ,(u'Entertainment', u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' )
,(u'Living' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' ) ,(u'Living' , u'http://www.thestar.com/rss/0?searchMode=Query&categories=296' )
,(u'Travel' , u'http://www.thestar.com/rss/82858?searchMode=Lineup' ) ,(u'Travel' , u'http://www.thestar.com/rss/82858?searchMode=Lineup' )
,(u'Science' , u'http://www.thestar.com/rss/82848?searchMode=Query&categories=300') ,(u'Science' , u'http://www.thestar.com/rss/82848?searchMode=Query&categories=300')
] ]
def print_version(self, url): def print_version(self, url):
return url.replace('/article/','/printArticle/') artl = url.rpartition('--')[0]
artid = artl.rpartition('/')[2]
return 'http://www.thestar.com/printarticle/' + artid