From 5d3c3092584018e08d5324a645d91bad1bc99c08 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 8 May 2009 09:49:17 -0700 Subject: [PATCH] New recipe for the Straits Times by Darko Miletic --- src/calibre/gui2/images/news/straitstimes.png | Bin 0 -> 953 bytes src/calibre/web/feeds/recipes/__init__.py | 1 + .../web/feeds/recipes/recipe_straitstimes.py | 56 ++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/calibre/gui2/images/news/straitstimes.png create mode 100644 src/calibre/web/feeds/recipes/recipe_straitstimes.py diff --git a/src/calibre/gui2/images/news/straitstimes.png b/src/calibre/gui2/images/news/straitstimes.png new file mode 100644 index 0000000000000000000000000000000000000000..b72f58318aa2ea81f672333d96c44c9015c51ba2 GIT binary patch literal 953 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?>V;x;TbdoK`&+n=vg_;=srMrFYL4?|;Ah zY>bi91cOEV;afIHZD}@WZc3OW6eN&1vGNl8rQ@Cpo#X@Nx`;HFs5h1hxp^j)1sJUA z?b{Til9{&9G}in6+rKsMe($n+QT|2v-HoTE-5sG{oY*IG{Poai*yOoR%fJ^dvt3*SDD_WUC&n<9r^q3Icle?pp z{oP%ko4KEEZhRl{LSyzZb&s9rkH?>Je7E?Z16PxV^t$--H@kgT`Q5>$z)i zYT3u^%Jf$Z`So9TKd0*#-~HvdE3-A%-^PEzgCBqLZMHnsyLaomPX4~#^PT6*J^fm% zfAQTHja60MDh5_n#$o^GH6Kq~vE0m7Tu1td$4Ws4=3Q0}+I=7HtbXtKnCnZs@cs|q zgSt;vn{BFmlVzg5WSi7!#xBJVY@S|C(ia`?1kMSP^^6s1S=;~S*?LzCi>=db&*!9H zuws$%I#6xFSjteqv{T52Z_<)Bp#zc!oSLUBSfN+=^FC`*q=TXW>k-DojKT{pD$HzD z59vPhb7|_ldz|TDZpGEsFzy%zX9FG%z9(`O{fBO^NL``x;qAxEHs2nx zUpYNVyv#2sQ*BCfhL(V~U^h#1LWBDz{zvy5!q-Qh{^1)Qm^|_3%}BqwHpeflO7vk~ z+E5zJ!8XakVF~lE|Go~}@6~AsSI>7@Z7-2DbF1>}A0MB%HaT2x*wh%5n3ckMT`q&& z>5%H;`nVlOc1f>KeD*@Uru2vNKD&(v)?HubDWuuFC@G~y_qKey(7X9H0zL;tIXw2{ zwjY0J>T}Qb;KcL$Q!L$2-B|cajU!xWNy8nrs`)|2mLgkkLH1pW1s|P1nAESHK0B^i@k-BTABsQWHy3byI)@gOP!O zrLKXgu7O2}p_!G5xs{Qrwt<0_fq|T111M{OHRR@}WTsVOYB04jHUlb!XwX`B<_}N< NgQu&X%Q~loCIIi3m<|8{ literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 73b0e67122..48e5d9e720 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -42,6 +42,7 @@ recipe_modules = ['recipe_' + r for r in ( 'moneynews', 'der_standard', 'diepresse', 'nzz_ger', 'hna', 'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms', 'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews', + 'straitstimes', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_straitstimes.py b/src/calibre/web/feeds/recipes/recipe_straitstimes.py new file mode 100644 index 0000000000..45caec4d87 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_straitstimes.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.straitstimes.com +''' + +from calibre.web.feeds.recipes import BasicNewsRecipe + +class StraitsTimes(BasicNewsRecipe): + title = 'The Straits Times' + __author__ = 'Darko Miletic' + description = 'Singapore newspaper' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'cp1252' + publisher = 'Singapore Press Holdings Ltd.' + category = 'news, politics, singapore, asia' + language = _('English') + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + remove_tags = [ + dict(name=['object','link']) + ,dict(name='table', attrs={'width':'980'}) + ,dict(name='td' , attrs={'class':'padlrt10'}) + ] + + feeds = [ + (u'Singapore' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_singapore.xml' ) + ,(u'SE Asia' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_sea.xml' ) + ,(u'Money' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_money.xml' ) + ,(u'Sport' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_sport.xml' ) + ,(u'World' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_world.xml' ) + ,(u'Tech & Science' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_tech.xml' ) + ,(u'Lifestyle' , u'http://www.straitstimes.com/STI/STIFILES/rss/break_lifestyle.xml' ) + ] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + return soup + + def print_version(self, url): + return url.replace('http://www.straitstimes.com','http://www.straitstimes.com/print') + \ No newline at end of file