From 58268e61c3ea79a909259bc94fc23f38f97ddcc7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 Sep 2011 10:40:49 -0600 Subject: [PATCH] RT by Darko Mieltic. Fixes #849987 (New recipe for Russian newsportal RT in English) --- recipes/icons/rtnews.png | Bin 0 -> 606 bytes recipes/rtnews.recipe | 64 ++++++++++++++++++++++++++++++ src/calibre/utils/localization.py | 1 + 3 files changed, 65 insertions(+) create mode 100644 recipes/icons/rtnews.png create mode 100644 recipes/rtnews.recipe diff --git a/recipes/icons/rtnews.png b/recipes/icons/rtnews.png new file mode 100644 index 0000000000000000000000000000000000000000..f29cc707a8774d54afab0308f19f33a776a2cfc9 GIT binary patch literal 606 zcmV-k0-^nhP)D#(**4 zUj;mTeJ2*tJ|)VuGIw@i)Gi)s-A;ly4NY(NC*fYp?ieLO4t_WQBYR+_`eQah16#;A z)53th)}S2vP5KvbApk-~P?-_^6yHJYfg;_D0w_b2VakX;jx96CtV}T0R4`HpQ-^>N zc60SdRMGUM=2km^3sxs9Nl$b(V-RW_^_?#=j~`yHue}c;y)c)Cp{y)}#mlr*p=HnJRl6G|&2zPx*(NO0L_UA? zsTZY~AlT9l9+X$U{)j4?U%b{$L%23`DWUrM+d%?P4h%lQ01$VCt|DYPoN~vTzwoqJ z1l+e>pK)Jn!7IZZ-5LXncd!H&?J!|y77X~@2!;bhA|zZmO|l7z2v5AB(UfKSjs9vH$=807*qoM6N<$g7Y^N3;+NC literal 0 HcmV?d00001 diff --git a/recipes/rtnews.recipe b/recipes/rtnews.recipe new file mode 100644 index 0000000000..22cdc6467f --- /dev/null +++ b/recipes/rtnews.recipe @@ -0,0 +1,64 @@ +__license__ = 'GPL v3' +__copyright__ = '2011, Darko Miletic ' +''' +rt.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class RT_eng(BasicNewsRecipe): + title = 'RT in English' + __author__ = 'Darko Miletic' + description = 'RT is the first Russian 24/7 English-language news channel which brings the Russian view on global news.' + publisher = 'Autonomous Nonprofit Organization "TV-Novosti"' + category = 'news, politics, economy, finances, Russia, world' + oldest_article = 2 + no_stylesheets = True + encoding = 'utf8' + masthead_url = 'http://rt.com/s/css/img/printlogo.gif' + use_embedded_content = False + remove_empty_feeds = True + language = 'en_RU' + publication_type = 'newsportal' + extra_css = """ + body{font-family: Arial,Helvetica,sans-serif} + h1{font-family: Georgia,"Times New Roman",Times,serif} + .grey{color: gray} + .fs12{font-size: small} + """ + + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher': publisher + , 'language' : language + } + + keep_only_tags = [dict(name='div', attrs={'class':'all'})] + remove_tags = [ + dict(name=['object','link','embed','iframe','meta','link']) + ,dict(attrs={'class':'crumbs oh'}) + ] + remove_attributes = ['clear'] + + feeds = [ + (u'Politics' , u'http://rt.com/politics/rss/' ) + ,(u'USA' , u'http://rt.com/usa/news/rss/' ) + ,(u'Business' , u'http://rt.com/business/news/rss/' ) + ,(u'Sport' , u'http://rt.com/sport/rss/' ) + ,(u'Art&Culture', u'http://rt.com/art-and-culture/news/rss/') + ] + + def print_version(self, url): + return url + 'print/' + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('a'): + str = item.string + if str is None: + str = self.tag_to_string(item) + item.replaceWith(str) + return soup diff --git a/src/calibre/utils/localization.py b/src/calibre/utils/localization.py index 947ee823c6..3e9e133590 100644 --- a/src/calibre/utils/localization.py +++ b/src/calibre/utils/localization.py @@ -125,6 +125,7 @@ _extra_lang_codes = { 'en_HR' : _('English (Croatia)'), 'en_ID' : _('English (Indonesia)'), 'en_IL' : _('English (Israel)'), + 'en_RU' : _('English (Russia)'), 'en_SG' : _('English (Singapore)'), 'en_YE' : _('English (Yemen)'), 'en_IE' : _('English (Ireland)'),