From 64ede2a0eaf1223c6496bfd19c776b92fea4854c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 26 Nov 2010 07:41:30 -0700 Subject: [PATCH] The Workingham Times by DM. Fixes #7672 (New recipe for The Workingham Times) --- .../images/news/the_workingham_times.png | Bin 0 -> 1011 bytes resources/recipes/the_workingham_times.recipe | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 resources/images/news/the_workingham_times.png create mode 100644 resources/recipes/the_workingham_times.recipe diff --git a/resources/images/news/the_workingham_times.png b/resources/images/news/the_workingham_times.png new file mode 100644 index 0000000000000000000000000000000000000000..c22c910c9c539e722a4c6b9a6bbe78639d9644dc GIT binary patch literal 1011 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?@=|T^vI!PODx%n;jD>ap2+o>T^5G)AFAA zsZCD%Z@IiQm-TA- zwCV5933D7-_~@TkUmBDC*=aLOx-JJB8XM+pky$UJ^YKB(k&Rvlq}#Q>*v$Co@!6rY z!MHxBpxQjSAYft7V+X}2yJzdBowl4}RI;fh%Kqu>+qL_4Tz&N0UG3)l;1yBY4_{ZE zN>|siv6;F2=C+U~ncgEGpVhST=fB%``AW#qL!y!gS8rFZJ%w}nRE zdtG$;SZ%)lFg$m?{Aa?#Lr!y^S1mrCENqxu`EXs*5$9^9dGjRgtqKDyUm#ZJr5`TX|&|4Cm>FJGOp`E+T}N0Cqmg}$&!8`jGdY=~Nv&~nP5LOtf+ z*5ZHjvL@#FU;J!awCsROphP#f&RWw*8v`HplPmsSPqmN_I>D-Oa!1MPlc(I8WGbJt z&)+4ol=Wl7_K5ZGrnpVK#j{j|>tOOnjXm2lWDOEp{xdE<5>^>(HM<^|X;e#GBT7;d zOH!?pi&B9UgOP!ufv%yUu8~=Yfw`5DrIo3vE|6hhaGbaJ7>b76{FKbJN)!#2R>p=_ Y24)Zq&!79S12r&sy85}Sb4q9e0G!^!X#fBK literal 0 HcmV?d00001 diff --git a/resources/recipes/the_workingham_times.recipe b/resources/recipes/the_workingham_times.recipe new file mode 100644 index 0000000000..ad069f1e9b --- /dev/null +++ b/resources/recipes/the_workingham_times.recipe @@ -0,0 +1,59 @@ +__license__ = 'GPL v3' +__copyright__ = '2010, Darko Miletic ' +''' +www.getwokingham.co.uk +''' + +from calibre.web.feeds.recipes import BasicNewsRecipe + +class TheWorkinghamTimes(BasicNewsRecipe): + title = 'The Workingham Times' + __author__ = 'Darko Miletic' + description = 'News from UK' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'utf8' + publisher = 'The Wokingham Times - S&B media' + category = 'news, UK, world' + language = 'en_GB' + publication_type = 'newsportal' + extra_css = """ + body{ font-family: Arial,sans-serif } + img{display: block; margin-bottom: 0.4em} + """ + + conversion_options = { + 'comments' : description + ,'tags' : category + ,'language' : language + ,'publisher' : publisher + } + + keep_only_tags = [dict(name='div', attrs={'id':'article-body'})] + remove_tags = [ + dict(name='div' , attrs={'class':['ad']}) + ,dict(name=['meta','base','iframe','embed','object']) + ,dict(name='span' , attrs={'class':'caption small'}) + ] + remove_attributes = ['width','height','lang'] + + feeds = [ + ('Home' , 'http://www.getwokingham.co.uk/rss.xml' ) + ,('News' , 'http://www.getwokingham.co.uk/news/rss.xml' ) + ,('Entertainment', 'http://www.getwokingham.co.uk/entertainment/rss.xml') + ,('Lifestyle' , 'http://www.getwokingham.co.uk/lifestyle/rss.xml' ) + ] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('a'): + if item.string is not None: + str = item.string + item.replaceWith(str) + else: + item.name = 'span' + del item['href'] + return soup