From 2ee05f9414b57e724dc34f204986e58ff0f2f6dc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Apr 2009 23:36:44 -0700 Subject: [PATCH] Updated recipes for Telepolis. The news and articles have now been split into two separate recipes, for better formatting. --- src/calibre/gui2/images/news/telepolis.png | Bin 586 -> 586 bytes .../gui2/images/news/telepolis_artikel.png | Bin 0 -> 586 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_telepolis.py | 85 ++++++++++-------- .../feeds/recipes/recipe_telepolis_artikel.py | 43 +++++++++ 5 files changed, 94 insertions(+), 36 deletions(-) create mode 100644 src/calibre/gui2/images/news/telepolis_artikel.png create mode 100644 src/calibre/web/feeds/recipes/recipe_telepolis_artikel.py diff --git a/src/calibre/gui2/images/news/telepolis.png b/src/calibre/gui2/images/news/telepolis.png index 7b1c14b96cb21701f5e1eff679404ab85edc0cc5..5f39db7fb4b29f9fc4e2e160fe1033d17587d67a 100644 GIT binary patch delta 84 zcmX@ba*Abw7UzEkAY8C_`Q(kphZ)69bd8KcjEt>}O{`4KbPdd{3=FLH-r6;pmq|() dB4=P_WNu|@1d(GiXqdnN1fH&bF6*2UngF#N88iR@ delta 84 zcmX@ba*Abw7Uw?(Abc%xrD>z_VMcL7T?5My14}CtV=DtoT>}d%1B05gdKV`1GD#_8 UkyEaTc)|b#p00i_>zopr0HYNdQvd(} diff --git a/src/calibre/gui2/images/news/telepolis_artikel.png b/src/calibre/gui2/images/news/telepolis_artikel.png new file mode 100644 index 0000000000000000000000000000000000000000..5f39db7fb4b29f9fc4e2e160fe1033d17587d67a GIT binary patch literal 586 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#NE^T^vI!PWMh;Sa#b%z%{>!>E4FeX{~Kd zyqgme5_xz-(`KD7NUU3KFkfJ^gqP3hvr`T6@9Clne! zd|v(V^y9-{lpYi?98lF^VqYWT!D(OPz@p};IpGsir9+#1KhN&I6gM}EgBQMMY*((m zFL0MX#bDRspa)+?qt`1wn8y$;dg-?G$4^ZhuRa^^yDyx}U8?f|DV`W)zc3R=ywtecq{;|v`msOcv!{C%6>CtWAxnfNR zN7BD{^RzqlS4)=I_yurwylx0S(<3AL&3@ze_{p=UFrLlbBg%R9yWKY395b7=zsBt5 zj~<`+@x`UYdWw;eukpwI4Z%UDo=p1pYlrH`n6?QlH$)rO2`0VUG@m)8so+(>bUFX@ zCJDAA8GR*j_J@pTyIxpDn9f;t+G}B%wbIh=qjz=pe-1g8viFtbLm65rXsS!j2n?b__paup{S3j3^P6]*>', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''),] + + keep_only_tags = [dict(name = 'table',attrs={'class':'blogtable'})] + remove_tags = [dict(name='img'), dict(name='td',attrs={'class':'blogbottom'})] + + feeds = [(u'News', u'http://www.heise.de/tp/news.rdf')] + + html2lrf_options = [ + '--comment' , description + , '--category' , category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + def get_article_url(self, article): + '''if the linked article is of kind artikel don't take it''' + if (article.link.count('artikel') > 0) : + return None + return article.link + + def preprocess_html(self, soup): + mtag = '' + soup.head.insert(0,mtag) + return soup \ No newline at end of file diff --git a/src/calibre/web/feeds/recipes/recipe_telepolis_artikel.py b/src/calibre/web/feeds/recipes/recipe_telepolis_artikel.py new file mode 100644 index 0000000000..415f557d1f --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_telepolis_artikel.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +__license__ = 'GPL v3' +__copyright__ = '2009, Gerhard Aigner ' + +''' http://www.derstandard.at - Austrian Newspaper ''' +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class TelepolisArtikel(BasicNewsRecipe): + title = u'Telepolis (Artikel)' + __author__ = 'Gerhard Aigner' + publisher = 'Heise Zeitschriften Verlag GmbH & Co KG' + category = 'news' + description = 'Telepolis Artikel' + oldest_article = 7 + max_articles_per_feed = 100 + recursion = 0 + no_stylesheets = True + + use_embedded_content = False + remove_empty_feeds = True + + remove_tags_before = dict(name='h1') + remove_tags = [dict(name='img')] + + feeds = [(u'Artikel', u'http://www.heise.de/tp/rss/news-a.rdf')] + + preprocess_regexps = [(re.compile(r']*>', re.DOTALL|re.IGNORECASE), lambda match: ''), + (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda match: ''),] + + html2lrf_options = [ + '--comment' , description + , '--category' , category + , '--publisher', publisher] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + def print_version(self, url): + p = re.compile(r'\d{5}', re.DOTALL|re.IGNORECASE) + m = p.search(url) + return "http://www.heise.de/bin/tp/issue/r4/dl-artikel2.cgi?artikelnr="+ m.group() +"&mode=print" + \ No newline at end of file