From 3bb5d82da6985f9f98841efc2f86b4801d809947 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 6 Jul 2009 17:16:10 -0600 Subject: [PATCH] New Honduran recipes by Darko Miletic --- src/calibre/gui2/images/news/eltiempo_hn.png | Bin 0 -> 3315 bytes src/calibre/gui2/images/news/laprensa_hn.png | Bin 0 -> 306 bytes src/calibre/gui2/images/news/latribuna.png | Bin 0 -> 553 bytes src/calibre/web/feeds/recipes/__init__.py | 4 +- .../web/feeds/recipes/recipe_eltiempo_hn.py | 52 ++++++++++++++ .../web/feeds/recipes/recipe_laprensa_hn.py | 54 +++++++++++++++ .../web/feeds/recipes/recipe_latribuna.py | 65 ++++++++++++++++++ 7 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/eltiempo_hn.png create mode 100644 src/calibre/gui2/images/news/laprensa_hn.png create mode 100644 src/calibre/gui2/images/news/latribuna.png create mode 100644 src/calibre/web/feeds/recipes/recipe_eltiempo_hn.py create mode 100644 src/calibre/web/feeds/recipes/recipe_laprensa_hn.py create mode 100644 src/calibre/web/feeds/recipes/recipe_latribuna.py diff --git a/src/calibre/gui2/images/news/eltiempo_hn.png b/src/calibre/gui2/images/news/eltiempo_hn.png new file mode 100644 index 0000000000000000000000000000000000000000..56bba04b0a5b0b0b249cd667f29b2b717711b467 GIT binary patch literal 3315 zcmV004&%004{+008|`004nN004b?008NW002DY000@xb3BE2000U( zX+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHz3$DNjUR8-d%htIutdZEoQ0#b(FyTAa_ zdy`&8VVD_UC<6{NG_fI~0ue<-nj%P0#DLLIBvwSR5EN9f2P6n6F&ITuEN@2Ei>|D^ z_ww@lRz|vC zuzLs)$;-`!o*{AqUjza0dRV*yaMRE;fKCVhpQKsoe1Yhg01=zBIT!&C1$=TK@rP|Ibo3vKKm@PqnO#LJhq6%Ij6Hz*<$V$@wQAMN5qJ)hzm2h zoGcOF60t^#FqJFfH{#e-4l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iU>$fcI^60{wFIafsVE5V4w;qdJSu!J9tyWAuM6jBRs=5Ii=#_?(5 xhK7{e!q#Mz-+M z;HOVQMeKx^#!0ZTZFn%*h2KDhq1)7L51RoH{P?MRKxmw literal 0 HcmV?d00001 diff --git a/src/calibre/gui2/images/news/latribuna.png b/src/calibre/gui2/images/news/latribuna.png new file mode 100644 index 0000000000000000000000000000000000000000..06c9ebeef151ebe18bc556d5eb62c1b7d196ec46 GIT binary patch literal 553 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6n3BBRT^Rni_n+Ah2>S z4={E+nQaFWEGuwK2hw1@3^B*n9%f)*4D)nx4AD5>8o1ZnsZhlB{qyS!p0U5;&a6mV zV4A@h=zMVk-&T_yU*%m)wtMV$R#|Jts>i46C>SEp$QkBh>*%S)b=IV~s>Al}wv3;G zCDW^SJ}-FpFy_JhM|JK(JKXCgAN;>T`sow9XI;nVCbKX_YD&CpKKaO_`I)AVBa^RK zT&vlloYKg&%Mphy-dMNW=eF?aNtf1` zIb1YJP5b$%?W>j6KaB~??94LaufAGvkTeb#!m8Um&DO4-{`xz7THE$ndYhm&86R)p*00y^eiEBhja#3nxNvduNkYF$}FtF4$ zFxNFO3o$geGBmI<1hK6Q4BlC6>4Ry=%}>cptHjh`YGrC}Wn=--@LN0ssGfnr)78&q Iol`;+0Q^$dUjP6A literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 44fb9bd46e..51f0000605 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -51,9 +51,11 @@ recipe_modules = ['recipe_' + r for r in ( 'theeconomictimes_india', '7dias', 'buenosaireseconomico', 'diagonales', 'miradasalsur', 'newsweek_argentina', 'veintitres', 'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate', - 'fastcompany', 'accountancyage', + 'fastcompany', 'accountancyage', 'laprensa_hn', 'latribuna', + 'eltiempo_hn', )] + import re, imp, inspect, time, os from calibre.web.feeds.news import BasicNewsRecipe, CustomIndexRecipe, AutomaticNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup diff --git a/src/calibre/web/feeds/recipes/recipe_eltiempo_hn.py b/src/calibre/web/feeds/recipes/recipe_eltiempo_hn.py new file mode 100644 index 0000000000..e7fd23b797 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_eltiempo_hn.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.tiempo.hn +''' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag + +class ElTiempoHn(BasicNewsRecipe): + title = 'El Tiempo - Honduras' + __author__ = 'Darko Miletic' + description = 'Noticias de Honduras y mundo' + publisher = 'El Tiempo' + category = 'news, politics, Honduras' + oldest_article = 2 + max_articles_per_feed = 100 + use_embedded_content = False + no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + language = _('Spanish') + lang = 'es-HN' + direction = 'ltr' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True\npretty_print=True\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} img {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em}"' + + remove_tags = [dict(name=['form','object','embed','base'])] + + keep_only_tags = [dict(name='td' , attrs={'id':'mainbodycont'})] + + feeds = [(u'Noticias', u'http://www.tiempo.hn/index.php?format=feed&type=rss')] + + def preprocess_html(self, soup): + soup.html['lang'] = self.lang + soup.html['dir' ] = self.direction + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll(style=True): + del item['style'] + return self.adeify_images(soup) diff --git a/src/calibre/web/feeds/recipes/recipe_laprensa_hn.py b/src/calibre/web/feeds/recipes/recipe_laprensa_hn.py new file mode 100644 index 0000000000..b34f158400 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_laprensa_hn.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.laprensahn.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag + +class LaPrensaHn(BasicNewsRecipe): + title = 'La Prensa - Honduras' + __author__ = 'Darko Miletic' + description = 'Noticias de Honduras y mundo' + publisher = 'La Prensa' + category = 'news, politics, Honduras' + oldest_article = 2 + max_articles_per_feed = 100 + use_embedded_content = False + no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + language = _('Spanish') + lang = 'es-HN' + direction = 'ltr' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\npretty_print=True\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "' + + remove_tags = [dict(name=['form','object','embed'])] + + keep_only_tags = [ + dict(name='h1' , attrs={'class':'titulo1'}) + ,dict(name='div', attrs={'class':['sumario11','hora','texto']}) + ] + + feeds = [(u'Noticias', u'http://feeds.feedburner.com/laprensa_titulares')] + + def preprocess_html(self, soup): + soup.html['lang'] = self.lang + soup.html['dir' ] = self.direction + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll(style=True): + del item['style'] + return soup diff --git a/src/calibre/web/feeds/recipes/recipe_latribuna.py b/src/calibre/web/feeds/recipes/recipe_latribuna.py new file mode 100644 index 0000000000..d3a9a333cb --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_latribuna.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.latribuna.hn +''' + +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag + +class LaTribuna(BasicNewsRecipe): + title = 'La Tribuna - Honduras' + __author__ = 'Darko Miletic' + description = 'Noticias de Honduras y mundo' + publisher = 'La Tribuna' + category = 'news, politics, Honduras' + oldest_article = 2 + max_articles_per_feed = 100 + use_embedded_content = False + no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + language = _('Spanish') + lang = 'es-HN' + direction = 'ltr' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\npretty_print=True\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "' + + remove_tags = [dict(name=['form','object','embed'])] + + keep_only_tags = [ + dict(name='p', attrs={'id':['BlogTitle','BlogDate']}) + ,dict(name='div', attrs={'id':'BlogContent'}) + ] + + feeds = [(u'Noticias', u'http://www.latribuna.hn/web2.0/?feed=rss')] + + def print_version(self, url): + return url + '&print=1' + + def preprocess_html(self, soup): + soup.html['lang'] = self.lang + soup.html['dir' ] = self.direction + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup('http://www.latribuna.hn/web2.0/') + cover_item = soup.find('div',attrs={'class':'portada_impresa'}) + if cover_item: + cover_url = cover_item.a.img['src'] + return cover_url