From d8ed8c0c079ce5985b4a44160a03d23040231080 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 14 Apr 2009 12:07:10 -0700 Subject: [PATCH] New recipe for NZZ Online by Darko Miletic --- src/calibre/gui2/images/news/nzz_ger.png | Bin 0 -> 811 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_nzz_ger.py | 66 ++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/nzz_ger.png create mode 100644 src/calibre/web/feeds/recipes/recipe_nzz_ger.py diff --git a/src/calibre/gui2/images/news/nzz_ger.png b/src/calibre/gui2/images/news/nzz_ger.png new file mode 100644 index 0000000000000000000000000000000000000000..ba9591853f174d660a8e26fcd84f9262d2c9c882 GIT binary patch literal 811 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87??slT^vI!PNz;b^pJ5BY1`j%bo1=DW!(+Y zEO$!OIW}&%;1}%b+0`QQP$7Y%aYgSztGi1%gdDG&i(v5;-17O2pW*|qCT)&)rPULX zme0QK+ZF5YyR7oep348fpV$Al$*8mWax$VN>L@3V=8OOV*414KD;gX(hCJ62;C%C6 zPa?<1#bkN1z$?`ip_}F{HB4e)yjuM;OaI9#o{aTgS^hWgoXnj6+YC2;@P?W?4sYoa0YnwLBGyJEKP@g@`py`_5u}iOKe9w1(IY(qg2&-1p z0-la*XF@X1nM;@oNGQG+Tf!<5mTBi55o^D6>%1_YEVZsHJR&P5hVMTkAi06>)H+oI zCw1LG@fo|$8MAyiF3e)Q5M`~lzbL0>o)haWcgsle zY4==8{B+i?myNUY?{I$j;LM^~jUHzm4)V002zB#6$WSPBd8be1)(Mv-+U~wLW=KgF zJE57=5S)sn{|H$znQMOBCe#o-HtxUn=c-*W!CnPxmTk2j9y+AdFLMB!t=B8VEpS?-{*&>{l5fEY^o)$5hck*sfi`2 zx+y?{!N|bCQrEyl*U%)y(8$Wb#LB=-*TCG$z`)D7<{?Z&ZhlH;S|z3iQ!672D^nwg VhG}*6TY(xFJYD@<);T3K0RTHJQ}h4; literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index c006501ca5..c6444ec48e 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -39,7 +39,7 @@ recipe_modules = ['recipe_' + r for r in ( 'nacional_cro', '24sata', 'dnevni_avaz', 'glas_srpske', '24sata_rs', 'krstarica', 'krstarica_en', 'tanjug', 'laprensa_ni', 'azstarnet', 'corriere_della_sera_it', 'corriere_della_sera_en', 'msdnmag_en', - 'moneynews', 'der_standard', 'diepresse', + 'moneynews', 'der_standard', 'diepresse', 'nzz_ger', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_nzz_ger.py b/src/calibre/web/feeds/recipes/recipe_nzz_ger.py new file mode 100644 index 0000000000..cdd23064bb --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_nzz_ger.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +www.nzz.ch +''' + +from calibre.web.feeds.recipes import BasicNewsRecipe + +class Nzz(BasicNewsRecipe): + title = 'NZZ Online' + __author__ = 'Darko Miletic' + description = 'Laufend aktualisierte Nachrichten, Analysen und Hintergruende zu Politik, Wirtschaft, Kultur und Sport' + publisher = 'NZZ AG' + category = 'news, politics, nachrichten, Switzerland' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + lang = 'de-CH' + language = _('German') + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"' + + keep_only_tags = [dict(name='div', attrs={'class':'article'})] + + remove_tags = [ + dict(name=['object','link','base','script']) + ,dict(name='div',attrs={'class':['more','teaser','advXertXoriXals','legal']}) + ,dict(name='div',attrs={'id':['popup-src','readercomments','google-ad','advXertXoriXals']}) + ] + + feeds = [ + (u'Neuste Artikel', u'http://www.nzz.ch/feeds/recent/' ) + ,(u'International' , u'http://www.nzz.ch/nachrichten/international?rss=true') + ,(u'Schweiz' , u'http://www.nzz.ch/nachrichten/schweiz?rss=true') + ,(u'Wirtschaft' , u'http://www.nzz.ch/nachrichten/wirtschaft/aktuell?rss=true') + ,(u'Finanzmaerkte' , u'http://www.nzz.ch/finanzen/nachrichten?rss=true') + ,(u'Zuerich' , u'http://www.nzz.ch/nachrichten/zuerich?rss=true') + ,(u'Sport' , u'http://www.nzz.ch/nachrichten/sport?rss=true') + ,(u'Panorama' , u'http://www.nzz.ch/nachrichten/panorama?rss=true') + ,(u'Kultur' , u'http://www.nzz.ch/nachrichten/kultur/aktuell?rss=true') + ,(u'Wissenschaft' , u'http://www.nzz.ch/nachrichten/wissenschaft?rss=true') + ,(u'Medien' , u'http://www.nzz.ch/nachrichten/medien?rss=true') + ,(u'Reisen' , u'http://www.nzz.ch/magazin/reisen?rss=true') + ] + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mtag = '' + soup.head.insert(0,mtag) + return soup + + def print_version(self, url): + return url + '?printview=true' +