From 3525827192283f180f94b2140609792a0c0de5a0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Jan 2009 09:44:34 -0800 Subject: [PATCH] Recipe for German Tom's Hardware by Oliver Niesner --- .../gui2/images/news/tomshardware_de.png | Bin 0 -> 992 bytes src/calibre/web/feeds/recipes/__init__.py | 3 +- .../web/feeds/recipes/recipe_tomshardware.py | 3 +- .../feeds/recipes/recipe_tomshardware_de.py | 54 ++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/calibre/gui2/images/news/tomshardware_de.png create mode 100644 src/calibre/web/feeds/recipes/recipe_tomshardware_de.py diff --git a/src/calibre/gui2/images/news/tomshardware_de.png b/src/calibre/gui2/images/news/tomshardware_de.png new file mode 100644 index 0000000000000000000000000000000000000000..c31412474caf6291120957e4228b463ecf420bf7 GIT binary patch literal 992 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%b@U_I1CZGssfk$L9 zkoEv$x0Bg+Ai=T%$8;bK*3S@gZ0%tN24+rA7sn8b)2)+pJ?^l|9JjCke@S<4-mba+ zCZe?)?{XD7Dg_;zvsX|ian02@-{yiQ#S;ojI#Vj0<8`Wq&K(fA*8Fx`>X8NaOpB7u zK0n+Qw!>F{%I7=J&J~yc+Q0k%cJbN9H@ofL*Zp~L`1{fC*&aguf`<+~_&>2FQ9>e` zl|M3$XOoHP$>so#o1QX~GgEfYQ_X*WPyIwaV6?A@9ha--W41^iVc-v1X#_v2G_?`JeHx9>myJo#?d=IrNupTfdB z{{CcN_t@8BQ#td5ESpm$kDJ8P^Y~QP%O|S}J^YeszVN8P(W6IG($hcx-l`D3{(oDt z>Y48H>6M?~3X6z}HmS5upJsCJ^|Uuj*6dh%?3miuuU|E#dQWZ3Z9SYQo1Zh~^3Lc~ z_ES^0**dqjwicC_Yl}X3cjms$i94NBJuZE}DCy9Vr6ADG2QE`v#l*P^2p=D8aw&Ca`Vhg ze`7PVW5ImvsqFKP-@V#7bN>AQ5BsOjKmXa8FQ_8HBpML+Hw4|?(kMY#$)8UnsJFBXy zR6MuqSDDs+{NvoH^4H30RaY0+)VKH7f4<+J(d?nJ=-02R(9qD8d-ul1*IKXH+FIFL zR=eP8K}E2FXYuCEyFT4i@AB(;yMgKI%Czc6;>BhhuqFUk_QIcGgnpl#mn*t;lj0_AcbPbJkjSWK# v%&km~txODc4J@n-3>YUYxCzsco1c=IR!KlZoZ_{&Kn)C@u6{1-oD!M<@SeXR literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 0c6e48131e..faeb65c193 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -21,7 +21,8 @@ recipe_modules = ['recipe_' + r for r in ( 'linux_magazine', 'telegraph_uk', 'utne', 'sciencedaily', 'forbes', 'time_magazine', 'endgadget', 'fudzilla', 'nspm_int', 'nspm', 'pescanik', 'spiegel_int', 'themarketticker', 'tomshardware', 'xkcd', 'ftd', 'zdnet', - 'joelonsoftware', 'telepolis', 'common_dreams', 'nin', + 'joelonsoftware', 'telepolis', 'common_dreams', 'nin', 'tomshardware_de', + )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_tomshardware.py b/src/calibre/web/feeds/recipes/recipe_tomshardware.py index 657a6911f7..b0b155666f 100644 --- a/src/calibre/web/feeds/recipes/recipe_tomshardware.py +++ b/src/calibre/web/feeds/recipes/recipe_tomshardware.py @@ -6,7 +6,6 @@ __copyright__ = '2008, Darko Miletic ' tomshardware.com ''' -from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.web.feeds.recipes import BasicNewsRecipe class Tomshardware(BasicNewsRecipe): @@ -50,7 +49,7 @@ class Tomshardware(BasicNewsRecipe): rmain, rsep, article_id = main.rpartition(',') tmain, tsep, trest = rmain.rpartition('/reviews/') if tsep: - return 'http://www.tomshardware.com/review_print.php?p1=' + article_id + return 'http://www.tomshardware.com/review_print.php?p1=' + article_id return 'http://www.tomshardware.com/news_print.php?p1=' + article_id def preprocess_html(self, soup): diff --git a/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py b/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py new file mode 100644 index 0000000000..78d820e246 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_tomshardware_de.py @@ -0,0 +1,54 @@ +__license__ = 'GPL v3' +__copyright__ = '2008, Kovid Goyal ' + +''' +Fetch tomshardware. +''' + +from calibre.web.feeds.news import BasicNewsRecipe +import re + + +class TomsHardwareDe(BasicNewsRecipe): + + title = 'Tom\'s Hardware German' + description = 'Computer news in german' + __author__ = 'Oliver Niesner' + use_embedded_content = False + timefmt = ' [%d %b %Y]' + max_articles_per_feed = 50 + no_stylesheets = True + encoding = 'utf-8' + + #preprocess_regexps = \ +# [(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in +# [ +# (r'<84>', lambda match: ''), +# (r'<93>', lambda match: ''), +# ] +# ] + + remove_tags = [dict(id='outside-advert'), + dict(id='advertRightWhite'), + dict(id='header-advert'), + dict(id='header-banner'), + dict(id='header-menu'), + dict(id='header-top'), + dict(id='header-tools'), + dict(id='nbComment'), + dict(id='internalSidebar'), + dict(id='header-news-infos'), + dict(id='breadcrumbs'), + dict(id=''), + dict(name='div', attrs={'class':'pyjama'}), + dict(name='href', attrs={'class':'comment'}), + dict(name='div', attrs={'class':'greyBoxR clearfix'}), + dict(name='div', attrs={'class':'greyBoxL clearfix'}), + dict(name='div', attrs={'class':'greyBox clearfix'}), + dict(id='')] + #remove_tags_before = [dict(id='header-news-title')] + remove_tags_after = [dict(name='div', attrs={'class':'news-elm'})] + #remove_tags_after = [dict(name='div', attrs={'class':'intelliTXT'})] + + feeds = [ ('tomshardware', 'http://www.tomshardware.com/de/feeds/rss2/tom-s-hardware-de,12-1.xml') ] +