From 502f0e4cbae0f3da27e92d478c44d0806371de2e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 25 Mar 2009 10:27:46 -0700 Subject: [PATCH] Implement #2151 (New recipe for new portal "24 sata") --- src/calibre/gui2/images/news/24sata_rs.png | Bin 0 -> 830 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_24sata_rs.py | 52 ++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/24sata_rs.png create mode 100644 src/calibre/web/feeds/recipes/recipe_24sata_rs.py diff --git a/src/calibre/gui2/images/news/24sata_rs.png b/src/calibre/gui2/images/news/24sata_rs.png new file mode 100644 index 0000000000000000000000000000000000000000..21736bd8f98b782d418e3d0fd97447ab30c4b9a2 GIT binary patch literal 830 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?{#MT^vI!PEVbD)_Y2z$g%q8`^xW0?q_xN z@z!zf+N5;GWYVUnZJC0)O;H{KA|j4o%(qO`;E37Mp#;R!)}B&Q(R?ftsTWqvm-U>1L8Ij8zu@wr;Llku-YW9P89{5L=P@6`gS_@irDTm$sk9Sy(9 zb}z{~y;Cf7%LLaPt~*{AH0l-zPFm%>SElT?;GAu842yDRJ$RV9;baga~99Liac9o9)ugdStDZGwY)#p|PpKWKwLhr46WMk0vrrY(ij+{HV>0(M3-hk#8>{;8ab!GDJSpXKnQc-3dI#q#`U;R@;1t*k!B<%E9g3H0zL&oY0!<-3rd?SXH6kM3Ia-7OW`s5xz&eBaGo zIep!tvt8@okHd{^FT literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index d9d63ea0d3..0cb80ec192 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -36,7 +36,7 @@ recipe_modules = ['recipe_' + r for r in ( 'el_universal', 'mediapart', 'wikinews_en', 'ecogeek', 'daily_mail', 'new_york_review_of_books_no_sub', 'politico', 'adventuregamers', 'mondedurable', 'instapaper', 'dnevnik_cro', 'vecernji_list', - 'nacional_cro', '24sata', 'dnevni_avaz', 'glas_srpske', + 'nacional_cro', '24sata', 'dnevni_avaz', 'glas_srpske', '24sata_rs', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_24sata_rs.py b/src/calibre/web/feeds/recipes/recipe_24sata_rs.py new file mode 100644 index 0000000000..ac4ee2b860 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_24sata_rs.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +24sata.rs +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class Ser24Sata(BasicNewsRecipe): + title = '24 Sata - Sr' + __author__ = 'Darko Miletic' + description = '24 sata portal vesti iz Srbije' + publisher = 'Ringier d.o.o.' + category = 'news, politics, entertainment, Serbia' + oldest_article = 1 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + language = _('Serbian') + + extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: serif1, serif}' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + feeds = [(u'Vesti Dana', u'http://www.24sata.rs/rss.php')] + + def preprocess_html(self, soup): + soup.html['xml:lang'] = 'sr-Latn-RS' + soup.html['lang'] = 'sr-Latn-RS' + mtag = '\n' + soup.head.insert(0,mtag) + return soup + + def print_version(self, url): + article, sep, rest = url.partition('#') + return article.replace('/show.php','/_print.php') +