From 6133b873e14377e01af2955abfbb45f054c68eb8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 23 Feb 2011 06:32:24 -0700 Subject: [PATCH] 20 Minutos by Darko Miletic. Fixes #9115 (New recipe for 20 Minutos spanish diary) --- resources/images/news/20minutos.png | Bin 0 -> 800 bytes resources/recipes/20minutos.recipe | 68 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 resources/images/news/20minutos.png create mode 100644 resources/recipes/20minutos.recipe diff --git a/resources/images/news/20minutos.png b/resources/images/news/20minutos.png new file mode 100644 index 0000000000000000000000000000000000000000..3e656913c7390b9a7460c0d5b914f83b240fa6aa GIT binary patch literal 800 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbQ|Pfsr-9C&ZP(W(tEvk3`@c4#z2$ zscXGTw+7X2<#3%N;5)}MbFF6N(sP%e|NsAg>%Mag1}zLGJ) ze}4a7cI}k4`>r_^Ze6Eodl*cnFzECc#xA{g|2c_+xMJu z*S0J=7nRwv_VB&`pWhpXwk+LtZOW>13>GZ{jy+RmEoIQDwoIJjlsYB3Yp z95y|gzAaI;TbC|dyLQ{Lwd=N4w=F$(`FZvvAbYQ(XUpEh=M;UX1QpH+%AI2v+GClz zbkD;3nZR&iO!9Vj;c46)m<;4_7I;J!18EO1b~~AE2UHN`>EaloaenH=$lyZ;BCYzq z;#}cOLJNbY1Wj8eA{ZbjE@EDAnD@*7|00`v`u4p%dHQ5c@uX^@hW#2}i<1Q|Puk?$ zzN9moJN>3)5`$u7NYrUY(@(d=H5$K82~FvF=(aMaVzy{}Mc7@fZk7vgqjWi5Me<1B z$YFK7!1qZ8 zeUv+OWS`d!Eyt6M>eH-~zH(WgIa!fkQ^M0S@5N33W>2eAFU1uuN=k$YKYjD2<`nN_ z?E{^!4+uz$CrZR^+bv*zVVTf`jrW_hzpURW;!x9k^3Cre#%I46Sg(W})@Rt?n5XBc zGdttL)VX=4E8M0%kCf#4$nidEo_f?t_mcPCu91sh6lK}ktn%t!{#;yPbL*?d^}-AC zE8lVlEA891IfhgBey8&s{-@!^AGiL$rfxD<_nMqgYa%e1RZCnWN>UO_QmvAUQh^kM zk%6J1u7Q!Rk#UHDnU%4Dl@X9@Ze?IlbgH}xMMG|WN@iLmiUvz7Lt`sbBZ!7I6S=nn PH86O(`njxgN@xNAIwe#H literal 0 HcmV?d00001 diff --git a/resources/recipes/20minutos.recipe b/resources/recipes/20minutos.recipe new file mode 100644 index 0000000000..d7657f77c7 --- /dev/null +++ b/resources/recipes/20minutos.recipe @@ -0,0 +1,68 @@ +__license__ = 'GPL v3' +__copyright__ = '2011, Darko Miletic ' +''' +www.20minutos.es +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class t20Minutos(BasicNewsRecipe): + title = '20 Minutos' + __author__ = 'Darko Miletic' + description = 'Diario de informacion general y local mas leido de Espania, noticias de ultima hora de Espania, el mundo, local, deportes, noticias curiosas y mas' + publisher = '20 Minutos Online SL' + category = 'news, politics, Spain' + oldest_article = 2 + max_articles_per_feed = 200 + no_stylesheets = True + encoding = 'utf8' + use_embedded_content = True + language = 'es' + remove_empty_feeds = True + publication_type = 'newspaper' + masthead_url = 'http://estaticos.20minutos.es/css4/img/ui/logo-301x54.png' + extra_css = """ + body{font-family: Arial,Helvetica,sans-serif } + img{margin-bottom: 0.4em; display:block} + """ + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + remove_tags = [dict(attrs={'class':'mf-viral'})] + remove_attributes=['border'] + + feeds = [ + (u'Principal' , u'http://20minutos.feedsportal.com/c/32489/f/478284/index.rss') + ,(u'Cine' , u'http://20minutos.feedsportal.com/c/32489/f/478285/index.rss') + ,(u'Internacional' , u'http://20minutos.feedsportal.com/c/32489/f/492689/index.rss') + ,(u'Deportes' , u'http://20minutos.feedsportal.com/c/32489/f/478286/index.rss') + ,(u'Nacional' , u'http://20minutos.feedsportal.com/c/32489/f/492688/index.rss') + ,(u'Economia' , u'http://20minutos.feedsportal.com/c/32489/f/492690/index.rss') + ,(u'Tecnologia' , u'http://20minutos.feedsportal.com/c/32489/f/478292/index.rss') + ] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('a'): + limg = item.find('img') + if item.string is not None: + str = item.string + item.replaceWith(str) + else: + if limg: + item.name = 'div' + item.attrs = [] + else: + str = self.tag_to_string(item) + item.replaceWith(str) + for item in soup.findAll('img'): + if not item.has_key('alt'): + item['alt'] = 'image' + return soup +