From 5f81e69815f78aff75ff7b9d1a46d726453d6340 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Aug 2009 12:44:19 -0600 Subject: [PATCH] Implement #3261 (New recipe for Axxon news) --- src/calibre/gui2/images/news/axxon_news.png | Bin 0 -> 537 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_axxon_news.py | 61 ++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/axxon_news.png create mode 100644 src/calibre/web/feeds/recipes/recipe_axxon_news.py diff --git a/src/calibre/gui2/images/news/axxon_news.png b/src/calibre/gui2/images/news/axxon_news.png new file mode 100644 index 0000000000000000000000000000000000000000..c8b62364ef98e4290b8adc9906e956daa56f926e GIT binary patch literal 537 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI zAngIhZYQ(tK!Rljj_E*J0gT&!&6&%U&tX`Z?1KRLwDsfK2WSU_w(`I*?0W6+)y(5a$@cNM&4SR zpY`*(C0lYOUtdca1`>6)Y1xEhLrjD#UspY{-4Hb5;ZJY9|`q!k6KVA_j zxdPX-j7`5S+gdW~tFTdl@D%IQ5JA)cN%I`&D`GDHEqX9rf&z*IbVb%Pi?F5xHy?3CZ3&1?uVahiAPMmILo00`OdY!^mp>! z{BY>!d&W-(Q?2U+C%PUIRj&(OXi-ylXL(oV3l(ps`HlVao;GG%>HM23^X0_K1NAqb zu%6Aj_$khE(i>o~s+PD$l%yn}eUBjXT5BP(N5D?=dH%*w!E s@|tt=Q8eV{r(~v8B5N=(w=%Z0GBJZ_IOe*`6{vy1)78&qol`;+00VN;ZvX%Q literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 061c5746f4..a214ca7fa6 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -42,7 +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', 'index_hu', 'pcworld_hu', 'hrt', 'rts', + 'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts', 'axxon_news', 'h1', 'h2', 'h3', 'phd_comics', 'woz_die', 'elektrolese', 'climate_progress', 'carta', 'slashdot', 'publico', 'the_budget_fashionista', 'elperiodico_catalan', diff --git a/src/calibre/web/feeds/recipes/recipe_axxon_news.py b/src/calibre/web/feeds/recipes/recipe_axxon_news.py new file mode 100644 index 0000000000..cb9f5fca51 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_axxon_news.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +axxon.com.ar +''' +from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class Axxon_news(BasicNewsRecipe): + title = 'Axxon noticias' + __author__ = 'Darko Miletic' + description = 'Axxon, Ciencia Ficcion en Bits' + publisher = 'Axxon' + category = 'news, SF, Argentina, science, movies' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = False + use_embedded_content = False + language = _('Spanish') + lang = 'es-AR' + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : lang + , 'pretty_print' : True + } + + + keep_only_tags = [dict(name='div', attrs={'class':'post'})] + + remove_tags = [dict(name=['object','link','iframe','embed'])] + + feeds = [(u'Noticias', u'http://axxon.com.ar/noticias/feed/')] + + remove_attributes = ['style','width','height','font','border','align'] + + + def adeify_images2(cls, soup): + for item in soup.findAll('img'): + for attrib in ['height','width','border','align','style']: + if item.has_key(attrib): + del item[attrib] + oldParent = item.parent + if oldParent.name == 'a': + oldParent.name == 'p' + myIndex = oldParent.contents.index(item) + brtag = Tag(soup,'br') + oldParent.insert(myIndex+1,brtag) + return soup + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + soup.html.insert(0,mlang) + return self.adeify_images2(soup) +