From 08ae0e0a7d01c70be327904e16354fa6d0796945 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 19 Mar 2009 12:09:23 -0700 Subject: [PATCH] Fix #2101 (Croatian News recipe pack) --- src/calibre/gui2/images/news/24sata.png | Bin 0 -> 671 bytes src/calibre/gui2/images/news/nacional_cro.png | Bin 0 -> 315 bytes .../gui2/images/news/vecernji_list.png | Bin 0 -> 514 bytes src/calibre/web/feeds/recipes/__init__.py | 3 +- .../web/feeds/recipes/recipe_24sata.py | 57 +++++++++++++++++ .../web/feeds/recipes/recipe_dnevnik_cro.py | 60 ++++++++++++++++++ .../web/feeds/recipes/recipe_nacional_cro.py | 55 ++++++++++++++++ .../web/feeds/recipes/recipe_vecernji_list.py | 58 +++++++++++++++++ 8 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/24sata.png create mode 100644 src/calibre/gui2/images/news/nacional_cro.png create mode 100644 src/calibre/gui2/images/news/vecernji_list.png create mode 100644 src/calibre/web/feeds/recipes/recipe_24sata.py create mode 100644 src/calibre/web/feeds/recipes/recipe_dnevnik_cro.py create mode 100644 src/calibre/web/feeds/recipes/recipe_nacional_cro.py create mode 100644 src/calibre/web/feeds/recipes/recipe_vecernji_list.py diff --git a/src/calibre/gui2/images/news/24sata.png b/src/calibre/gui2/images/news/24sata.png new file mode 100644 index 0000000000000000000000000000000000000000..a1ff893670117cd7756b94c1508fbcb6f5b5ab14 GIT binary patch literal 671 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#L4@x;TbdoW48xp!Z}(iDUKmZ`m!I*()|x zLMNhFdX00et%yrTyOp=l+5OJiuMGHasWw|p74M%kH!Ez5bHKTq;>NBno+?{)FYSA{ z<>%YmmlHGE7j)14H8<|w^zW7OauvMX!Ecz)*G>CBx8bJPvQz`t+wJ8lUD`*|bp4j( zC7b+YoGxWO<0Hqz>*qV8gjptCFDQJ)CARFEyZct}vuod7jb~>!;rvyhvSRJaKXL!P z#m0lk@D21@w47N_>o&7JS&>AliSE z;Wv@=nStPOLp5XGfk3y3|6jaW+@thAQ6iQ%Ogtet;qQN5<%@9}{{3&87~(v` zBhaTzVbN}`nf@0TYGz4FusK^vuz5-{*m)Y=)#N&!475+R#5JNMxhOTUBvm&BNH7=~ z7+C5W80#8Zh8S8}85mianrj;vSQ!|&{agaqkei>9nO2FR!3e0@$jZnFqG7eyq02xU O7(8A5T-G@yGywpkh+eP& literal 0 HcmV?d00001 diff --git a/src/calibre/gui2/images/news/vecernji_list.png b/src/calibre/gui2/images/news/vecernji_list.png new file mode 100644 index 0000000000000000000000000000000000000000..eb900431af5610c4cc1dfaf6d6749d563031e360 GIT binary patch literal 514 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#OuZT^vI!PM@8;(VHnz;#j>~xZFd*_6&2` zOeJ2qI~VE&eMKFcy`#NnH~)8a?iSqA>MFq7n`l~6Xt9K4dWQvki+4e@MNcyHRs~wUjY13{^{9BTABsQWHy3byI)@ zgOP!OrLKXouAya!p{139k(H^rwt<0_fq~o4CCM-ix%nxXX_XinjEt;|jI9h!AQ~Fp S^lb-fVDNPHb6Mw<&;$TtZNI_* literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 1ac26c391f..0d1b72b9ca 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -35,7 +35,8 @@ recipe_modules = ['recipe_' + r for r in ( 'lamujerdemivida', 'soldiers', 'theonion', 'news_times', 'el_universal', 'mediapart', 'wikinews_en', 'ecogeek', 'daily_mail', 'new_york_review_of_books_no_sub', 'politico', 'adventuregamers', - 'mondedurable', 'instapaper', + 'mondedurable', 'instapaper', 'dnevnik_cro', 'vecernji_list', + 'nacional_cro', '24sata', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_24sata.py b/src/calibre/web/feeds/recipes/recipe_24sata.py new file mode 100644 index 0000000000..004e7ff5e6 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_24sata.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +24sata.hr +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class Cro24Sata(BasicNewsRecipe): + title = '24 Sata - Hr' + __author__ = 'Darko Miletic' + description = "News Portal from Croatia" + publisher = '24sata.hr' + category = 'news, politics, Croatia' + oldest_article = 2 + max_articles_per_feed = 100 + delay = 4 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + language = _('Croatian') + + 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 + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + remove_tags = [ + dict(name=['object','link','embed']) + ,dict(name='table', attrs={'class':'enumbox'}) + ] + + feeds = [(u'Najnovije Vijesti', u'http://www.24sata.hr/index.php?cmd=show_rss&action=novo')] + + def preprocess_html(self, soup): + soup.html['lang'] = 'hr-HR' + mtag = '\n' + soup.head.insert(0,mtag) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def print_version(self, url): + return url + '&action=ispis' + \ No newline at end of file diff --git a/src/calibre/web/feeds/recipes/recipe_dnevnik_cro.py b/src/calibre/web/feeds/recipes/recipe_dnevnik_cro.py new file mode 100644 index 0000000000..ada5ea22d5 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_dnevnik_cro.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +dnevnik.hr +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class DnevnikCro(BasicNewsRecipe): + title = 'Dnevnik - Hr' + __author__ = 'Darko Miletic' + description = "Vijesti iz Hrvatske" + publisher = 'Dnevnik.hr' + category = 'news, politics, Croatia' + oldest_article = 2 + max_articles_per_feed = 100 + delay = 4 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + language = _('Croatian') + + 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')] + + keep_only_tags = [dict(name='div', attrs={'id':'article'})] + + remove_tags = [ + dict(name=['object','link','embed']) + ,dict(name='div', attrs={'class':'menu'}) + ,dict(name='div', attrs={'id':'video'}) + ] + + remove_tags_after = dict(name='div', attrs={'id':'content'}) + + feeds = [(u'Vijesti', u'http://rss.dnevnik.hr/index.rss')] + + def preprocess_html(self, soup): + soup.html['lang'] = 'hr-HR' + mtag = '\n' + soup.head.insert(0,mtag) + for item in soup.findAll(style=True): + del item['style'] + return soup + diff --git a/src/calibre/web/feeds/recipes/recipe_nacional_cro.py b/src/calibre/web/feeds/recipes/recipe_nacional_cro.py new file mode 100644 index 0000000000..bbb0112ceb --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_nacional_cro.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +nacional.hr +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class NacionalCro(BasicNewsRecipe): + title = 'Nacional - Hr' + __author__ = 'Darko Miletic' + description = "news from Croatia" + publisher = 'Nacional.hr' + category = 'news, politics, Croatia' + oldest_article = 2 + max_articles_per_feed = 100 + delay = 4 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + language = _('Croatian') + + 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 + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + remove_tags = [dict(name=['object','link','embed'])] + + feeds = [(u'Najnovije Vijesti', u'http://www.nacional.hr/rss')] + + def preprocess_html(self, soup): + soup.html['lang'] = 'hr-HR' + mtag = '\n' + soup.head.insert(0,mtag) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def print_version(self, url): + rest, sep, disc = url.rpartition('/') + return rest.replace('/clanak/','/clanak/print/') + \ No newline at end of file diff --git a/src/calibre/web/feeds/recipes/recipe_vecernji_list.py b/src/calibre/web/feeds/recipes/recipe_vecernji_list.py new file mode 100644 index 0000000000..b34c49d9fa --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_vecernji_list.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +www.vecernji.hr +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class VecernjiList(BasicNewsRecipe): + title = 'Vecernji List' + __author__ = 'Darko Miletic' + description = "Vecernji.hr je vodeci hrvatski news portal. Cilj je biti prvi u objavljivanju svih vijesti iz Hrvatske, svijeta, sporta, gospodarstva, showbiza i jos mnogo vise. Uz cjelodnevni rad, novinari objavljuju preko 300 raznih vijesti svakoga dana. Vecernji.hr prati sve vaznije dogadaje specijalnim izvjestajima, video specijalima i foto galerijama." + publisher = 'Vecernji.hr' + category = 'news, politics, Croatia' + oldest_article = 2 + max_articles_per_feed = 100 + delay = 4 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + language = _('Croatian') + + 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')] + + remove_tags = [ + dict(name=['object','link','embed']) + ,dict(name='table', attrs={'class':'enumbox'}) + ] + + feeds = [(u'Vijesti', u'http://www.vecernji.hr/rss/')] + + def preprocess_html(self, soup): + soup.html['lang'] = 'hr-HR' + mtag = '\n' + soup.head.insert(0,mtag) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def print_version(self, url): + return url.replace('/index.do','/print.do') + \ No newline at end of file