From 1ba09aedec3da41bc74ada0d3195aa8ae4a7afcd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Feb 2010 09:37:46 -0700 Subject: [PATCH] Various Polish reciped by Tomasz Dlugosz --- resources/recipes/di.recipe | 60 ++++++++++++++++++++++ resources/recipes/eclicto.recipe | 49 ++++++++++++++++++ resources/recipes/eksiazki.recipe | 12 ++--- resources/recipes/interia_fakty.recipe | 38 ++++++++++++++ resources/recipes/interia_sport.recipe | 71 ++++++++++++++++++++++++++ resources/recipes/legeartis.recipe | 43 ++++++++++++++++ resources/recipes/legitymizm.recipe | 49 ++++++++++++++++++ resources/recipes/michalkiewicz.recipe | 26 ++++++++++ resources/recipes/nczas.recipe | 35 +++++++++++++ 9 files changed, 377 insertions(+), 6 deletions(-) create mode 100644 resources/recipes/di.recipe create mode 100644 resources/recipes/eclicto.recipe create mode 100644 resources/recipes/interia_fakty.recipe create mode 100644 resources/recipes/interia_sport.recipe create mode 100644 resources/recipes/legeartis.recipe create mode 100644 resources/recipes/legitymizm.recipe create mode 100644 resources/recipes/michalkiewicz.recipe create mode 100644 resources/recipes/nczas.recipe diff --git a/resources/recipes/di.recipe b/resources/recipes/di.recipe new file mode 100644 index 0000000000..3b3f6e5c7c --- /dev/null +++ b/resources/recipes/di.recipe @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__author__ = 'Mori' +__version__ = 'v. 0.5' +''' +di.com.pl +''' + +from calibre.web.feeds.news import BasicNewsRecipe +import re + +class DziennikInternautowRecipe(BasicNewsRecipe): + __author__ = 'Mori' + language = 'pl' + + title = u'Dziennik Internautow' + publisher = u'Dziennik Internaut\xc3\xb3w Sp. z o.o.' + description =u'Internet w \xc5\xbcyciu i biznesie. Porady, wywiady, interwencje, bezpiecze\xc5\x84stwo w Sieci, technologia.' + + max_articles_per_feed = 100 + oldest_article = 7 + cover_url = 'http://di.com.pl/pic/logo_di_norm.gif' + + no_stylesheets = True + remove_javascript = True + encoding = 'utf-8' + + extra_css = ''' + .fotodesc{font-size: 75%;} + .pub_data{font-size: 75%;} + .fotonews{clear: both; padding-top: 10px; padding-bottom: 10px;} + #pub_foto{font-size: 75%; float: left; padding-right: 10px;} + ''' + + feeds = [ + (u'Dziennik Internautów', u'http://feeds.feedburner.com/glowny-di') + ] + + keep_only_tags = [ + dict(name = 'div', attrs = {'id' : 'pub_head'}), + dict(name = 'div', attrs = {'id' : 'pub_content'}) + ] + + remove_tags = [ + dict(name = 'div', attrs = {'class' : 'poradniki_context'}), + dict(name = 'div', attrs = {'class' : 'uniBox'}), + dict(name = 'object', attrs = {}), + dict(name = 'h3', attrs = {}) + ] + + preprocess_regexps = [ + (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in + [ + (r', ', lambda match: '
'), + (r'http://di.com.pl/pic/photo/mini/', lambda match: 'http://di.com.pl/pic/photo/oryginal/'), + (r'\s*' ''' eksiazki.org @@ -10,17 +10,17 @@ from calibre.web.feeds.news import BasicNewsRecipe class eksiazki(BasicNewsRecipe): - title = u'eksiazki.org' - desciption = u'Twoje centrum wiedzy o epapierze i ebookach' + title = u'eKsiazki.org' + desciption = u'Twoje centrum wiedzy o ePapierze i eBookach' language = 'pl' __author__ = u'Tomasz D\u0142ugosz' no_stylesheets = True remove_javascript = True - feeds = [(u'wpisy', u'http://www.eksiazki.org/feed/')] + feeds = [(u'eKsiazki.org', u'http://www.eksiazki.org/feed/')] keep_only_tags = [dict(name='div', attrs={'id':'content-body'})] remove_tags = [ - dict(name='span', attrs={'class':'nr_comm'}), - dict(name='div', attrs={'id':'tabsContainer'}), + dict(name='span', attrs={'class':'nr_comm'}), + dict(name='div', attrs={'id':'tabsContainer'}), dict(name='div', attrs={'class':'next_previous_links'})] diff --git a/resources/recipes/interia_fakty.recipe b/resources/recipes/interia_fakty.recipe new file mode 100644 index 0000000000..cdd245fdd7 --- /dev/null +++ b/resources/recipes/interia_fakty.recipe @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2010, Tomasz Dlugosz ' +''' +fakty.interia.pl +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class InteriaFakty(BasicNewsRecipe): + title = u'Interia.pl - Fakty' + language = 'pl' + oldest_article = 7 + __author__ = u'Tomasz D\u0142ugosz' + simultaneous_downloads = 2 + no_stylesheets = True + remove_javascript = True + max_articles_per_feed = 100 + + feeds = [(u'Kraj', u'http://kanaly.rss.interia.pl/kraj.xml'), + (u'\u015awiat', u'http://kanaly.rss.interia.pl/swiat.xml'), + (u'Wiadomo\u015bci dnia', u'http://kanaly.rss.interia.pl/fakty.xml'), + (u'Przegl\u0105d prasy', u'http://kanaly.rss.interia.pl/przeglad_prasy.xml'), + (u'Wywiady', u'http://kanaly.rss.interia.pl/wywiady.xml'), + (u'Ciekawostki', u'http://kanaly.rss.interia.pl/ciekawostki.xml')] + + keep_only_tags = [dict(name='div', attrs={'id':'article'})] + + remove_tags = [ + dict(name='div', attrs={'class':'box fontSizeSwitch'}), + dict(name='div', attrs={'class':'clear'}), + dict(name='div', attrs={'class':'embed embedLeft articleEmbedArticleList articleEmbedArticleListTitle'}), + dict(name='span', attrs={'class':'keywords'})] + + extra_css = ''' + h2 { font-size: 1.2em; } + ''' diff --git a/resources/recipes/interia_sport.recipe b/resources/recipes/interia_sport.recipe new file mode 100644 index 0000000000..9c72ee28a7 --- /dev/null +++ b/resources/recipes/interia_sport.recipe @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2010, Tomasz Dlugosz ' +''' +sport.interia.pl +''' + +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class InteriaSport(BasicNewsRecipe): + title = u'Interia.pl - Sport' + language = 'pl' + oldest_article = 7 + __author__ = u'Tomasz D\u0142ugosz' + simultaneous_downloads = 3 + no_stylesheets = True + remove_javascript = True + max_articles_per_feed = 100 + + feeds = [(u'Wydarzenia sportowe', u'http://kanaly.rss.interia.pl/sport.xml'), + (u'Pi\u0142ka no\u017cna', u'http://kanaly.rss.interia.pl/pilka_nozna.xml'), + (u'Siatk\xf3wka', u'http://kanaly.rss.interia.pl/siatkowka.xml'), + (u'Koszyk\xf3wka', u'http://kanaly.rss.interia.pl/koszykowka.xml'), + (u'NBA', u'http://kanaly.rss.interia.pl/nba.xml'), + (u'Kolarstwo', u'http://kanaly.rss.interia.pl/kolarstwo.xml'), + (u'\u017bu\u017cel', u'http://kanaly.rss.interia.pl/zuzel.xml'), + (u'Tenis', u'http://kanaly.rss.interia.pl/tenis.xml')] + + keep_only_tags = [dict(name='div', attrs={'id':'article'})] + + remove_tags = [dict(name='div', attrs={'class':'object gallery'})] + + extra_css = ''' + .articleDate { + font-size: 0.5em; + color: black; + } + + .articleFoto { + display: block; + font-family: sans; + font-size: 0.5em; + text-indent: 0 + color: black; + } + + .articleText { + display: block; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + margin-top: 1em + color: black; + } + + .articleLead { + font-size: 1.2em; + } + ''' + + preprocess_regexps = [ + (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in + [ + (r'

', lambda match: ''), + # FIXME + #(r'(
)(.*?)()(.*?)()', lambda match: '\1\2\4'), + (r'

()?(ZOBACZ|CZYTAJ) T.*?

', lambda match: '
') + ] + ] diff --git a/resources/recipes/legeartis.recipe b/resources/recipes/legeartis.recipe new file mode 100644 index 0000000000..7d5de45035 --- /dev/null +++ b/resources/recipes/legeartis.recipe @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__author__ = 'Mori' +__version__ = 'v. 0.1' +''' +olgierd.bblog.pl +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class LegeArtisRecipe(BasicNewsRecipe): + __author__ = 'Mori' + language = 'pl' + + title = u'Lege Artis' + publisher = u'Olgierd Rudak' + description = u'Wszystko, co chcieliby\xc5\x9bcie wiedzie\xc4\x87 o prawie, ale wstydzicie si\xc4\x99 zapyta\xc4\x87' + + max_articles_per_feed = 100 + + no_stylesheets = True + remove_javascript = True + + extra_css = ''' + img{clear: both;} + ''' + + feeds = [ + (u'Lege Artis', u'http://olgierd.bblog.pl/rss/rss20.xml') + ] + + keep_only_tags = [ + dict(name = 'div', attrs = {'class' : 'post_title'}), + dict(name = 'div', attrs = {'class' : 'post_date'}), + dict(name = 'div', attrs = {'class' : 'post_content'}) + ] + + remove_tags = [ + dict(name = 'div', attrs = {'id' : 'bb_tools'}), + dict(name = 'div', attrs = {'class' : 'post_comments'}), + dict(name = 'object', attrs = {}) + ] diff --git a/resources/recipes/legitymizm.recipe b/resources/recipes/legitymizm.recipe new file mode 100644 index 0000000000..468f1b1d6b --- /dev/null +++ b/resources/recipes/legitymizm.recipe @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = u'2010, Tomasz Dlugosz ' +''' +legitymizm.org +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Legitymizm(BasicNewsRecipe): + title = u'Organizacja Monarchist\xf3w Polskich' + language = 'pl' + oldest_article = 7 + __author__ = u'Tomasz D\u0142ugosz' + max_articles_per_feed = 100 + cover_url = 'http://www.legitymizm.org/img_omp/logo.gif' + no_stylesheets = True + + feeds = [(u'Aktualno\u015bci i publicystyka', u'http://www.legitymizm.org/rss.php')] + + keep_only_tags = [dict(name='div', attrs={'id':'szeroka_kolumna'})] + remove_tags = [dict(name = 'div', attrs = {'class' : 'koniec_tresci_wlasciwej'}), + dict(name = 'div', attrs = {'class' : 'return'})] + + extra_css = ''' + body { font-family: Georgia, 'Times New Roman', Times, serif; } + h1 { color: #898981; font-weight: normal; font-size: 26px; letter-spacing: -1px; line-height: 23px; text-align: left; } + h2, h3 { font-weight: normal; font-size: 20px; line-height: 23px; letter-spacing: -1px; margin: 0 0 3px 0; text-align: left; } + #szeroka_kolumna { float: left; line-height: 20px; } + #szeroka_kolumna ul.wykaz { list-style-type: none; margin: 0 0 1.2em 0; padding: 0; } + #szeroka_kolumna ul.wykaz li.wykaz_2 { font-weight: bold; margin: 0.6em 0 0 0; } + #szeroka_kolumna ul.wykaz a { text-decoration: none; } + #szeroka_kolumna ul.wykaz li.wykaz_1, #szeroka_kolumna ul.wykaz li.wykaz_2 ul li { list-style-type: square; color: #898981; text-transform: none; font-weight: normal; padding: 0; } + #szeroka_kolumna ul.wykaz li.wykaz_1 { margin: 0 0 0 1.3em; } + #szeroka_kolumna ul.wykaz li.wykaz_2 ul { margin: 0; padding: 0 0 0 1.3em; } + #szeroka_kolumna h3.autor { background-color: #898981; color: #f9f9f8; margin: -25px 0px 30px 0; text-align: left; padding: 0 0 0 2px; } + .tresc_wlasciwa { border-top: 1px solid #898981; padding: 30px 0px 0px 0px; position: relative; } + #cytat { font-size: 11px; line-height: 19px; font-style: italic; text-align: justify; } + #cytat img { width: 100px; height: 105px; float: right; margin: 3px 0 0 10px; } + .duzy_cytat { padding: 20px 20px 10px 20px; margin: 0 0 1.2em 0; } + #szeroka_kolumna img, #szeroka_kolumna object { padding: 3px; border: 1px solid #898981; } + #szeroka_kolumna img.ilustracja { margin: 0px 10px 0 0; float: left; } + p { margin: 0 0 1.2em 0; } + #cytat p.sentencja { margin: 0; } + #cytat p.sentencja:first-letter { font-size: 44px; line-height: 33px; margin: 0 2px 0 0; font-style: normal; float: left; display: block; } + p.autor { text-transform: uppercase; color: #898981; font-style: normal; text-align: left; } + ''' + diff --git a/resources/recipes/michalkiewicz.recipe b/resources/recipes/michalkiewicz.recipe new file mode 100644 index 0000000000..ba58ba432b --- /dev/null +++ b/resources/recipes/michalkiewicz.recipe @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2010, Tomasz Dlugosz ' +''' +michalkiewicz.pl +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +# + +class michalkiewicz(BasicNewsRecipe): + title = u'Stanis\u0142aw Michalkiewicz' + desciption = u'Strona autorska * felietony * artyku\u0142y * komentarze' + __author__ = u'Tomasz D\u0142ugosz' + language = 'pl' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + + keep_only_tags = [dict(name='div', attrs={'class':'modul_srodek'})] + remove_tags = [dict(name='ul', attrs={'class':'menu'})] + + feeds = [(u'Teksty', u'http://www.michalkiewicz.pl/rss.xml')] + diff --git a/resources/recipes/nczas.recipe b/resources/recipes/nczas.recipe new file mode 100644 index 0000000000..ccf963e43a --- /dev/null +++ b/resources/recipes/nczas.recipe @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2010, Tomasz Dlugosz ' +''' +nczas.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +# + +class NCzas(BasicNewsRecipe): + title = u'Najwy\u017cszy Czas!' + desciption = u'Najwy\u017cszy Czas!\nwydanie internetowe' + __author__ = u'Tomasz D\u0142ugosz' + language = 'pl' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + cover_url = 'http://nczas.com/wp-content/themes/default/grafika/logo.png' + + keep_only_tags = [dict(name='div', attrs={'class':'trescartykulu'})] + + feeds = [(u'Najwy\u017cszy Czas!', u'http://nczas.com/feed/')] + + def postprocess_html(self, soup, first): + + for tag in soup.findAll(name= 'img', alt=""): + tag.extract() + + for item in soup.findAll(align = "right"): + del item['align'] + + return soup