Update The Toronto Star. Fixes #1112611 (Updated recipe for toronto star)

This commit is contained in:
Kovid Goyal 2013-02-01 21:37:14 +05:30
parent 7c75c384fb
commit f84ab10fec

View File

@ -1,7 +1,5 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2009-2013, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.thestar.com www.thestar.com
''' '''
@ -11,18 +9,17 @@ 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 = "Thestar.com is Canada's largest online news site. Stay current with our sports, business entertainment news and more from the Toronto Star and thestar.com"
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
#auto_cleanup = True
#auto_cleanup_keep = '//div[@class="topsContent topsContentActive"]'
use_embedded_content = False use_embedded_content = False
delay = 2 delay = 2
publisher = 'The Toronto Star' publisher = 'The Toronto Star'
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" 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"
encoding = 'utf-8' encoding = 'utf-8'
masthead_url = 'http://www.thestar.com/etc/designs/thestar/images/general/logoLrg.png'
conversion_options = { conversion_options = {
'comments' : description 'comments' : description
@ -30,23 +27,18 @@ class TheTorontoStar(BasicNewsRecipe):
,'publisher' : publisher ,'publisher' : publisher
} }
#keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})] remove_tags_before = dict(name='div',attrs={'class':'article-headline'})
#remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'})
feeds = [ feeds = [
(u'News' , u'http://www.thestar.com/rss/?categories=293' ) (u'News' , u'http://www.thestar.com/feeds.articles.news.rss' )
,(u'Opinion' , u'http://www.thestar.com/rss/?categories=303' ) ,(u'Opinion' , u'http://www.thestar.com/feeds.articles.opinion.rss' )
,(u'Business' , u'http://www.thestar.com/rss/?categories=294' ) ,(u'Business' , u'http://www.thestar.com/feeds.articles.business.rss' )
,(u'Sports' , u'http://www.thestar.com/rss/?categories=295' ) ,(u'Sports' , u'http://www.thestar.com/feeds.articles.sports.rss' )
,(u'Entertainment', u'http://www.toronto.com/rss?categories=6298' ) ,(u'Entertainment', u'http://www.thestar.com/feeds.articles.entertainment.rss' )
,(u'Living' , u'http://www.thestar.com/rss/?categories=297' ) ,(u'Living' , u'http://www.thestar.com/feeds.articles.life.rss' )
,(u'Travel' , u'http://www.thestar.com/rss/list/1042246?' ) ,(u'Travel' , u'http://www.thestar.com/feeds.articles.life.travel.rss' )
,(u'Science' , u'http://www.thestar.com/rss?categories=6481') ,(u'Technology' , u'http://www.thestar.com/feeds.articles.life.technology.rss')
] ]
def print_version(self, url): def print_version(self, url):
artl = url.rpartition('--')[0] return url.replace('.html', '.print.html')
artid = artl.rpartition('/')[2]
return 'http://www.thestar.com/printarticle/' + artid