From 37b410705228ecac6e1362371560327963a7d051 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 07:59:03 +0530 Subject: [PATCH] gs24.pl by Michal Szkutnik --- recipes/gs24_pl.recipe | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 recipes/gs24_pl.recipe diff --git a/recipes/gs24_pl.recipe b/recipes/gs24_pl.recipe new file mode 100644 index 0000000000..db7125b116 --- /dev/null +++ b/recipes/gs24_pl.recipe @@ -0,0 +1,43 @@ +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +import re +import string +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1322322819(BasicNewsRecipe): + title = u'GS24.pl (Głos Szczeciński)' + description = u'Internetowy serwis Głosu Szczecińskiego' + __author__ = u'Michał Szkutnik' + __license__ = u'GPL v3' + language = 'pl' + publisher = 'Media Regionalne sp. z o.o.' + category = 'news, szczecin' + oldest_article = 2 + max_articles_per_feed = 100 + auto_cleanup = True + cover_url = "http://www.gs24.pl/images/top_logo.png" + + feeds = [ + # (u'Wszystko', u'http://www.gs24.pl/rss.xml'), + (u'Szczecin', u'http://www.gs24.pl/szczecin.xml'), + (u'Stargard', u'http://www.gs24.pl/stargard.xml'), + (u'Świnoujście', u'http://www.gs24.pl/swinoujscie.xml'), + (u'Goleniów', u'http://www.gs24.pl/goleniow.xml'), + (u'Gryfice', u'http://www.gs24.pl/gryfice.xml'), + (u'Kamień Pomorski', u'http://www.gs24.pl/kamienpomorski.xml'), + (u'Police', u'http://www.gs24.pl/police.xml'), + (u'Region', u'http://www.gs24.pl/region.xml'), + (u'Sport', u'http://www.gs24.pl/sport.xml'), + ] + + def get_article_url(self, article): + s = re.search("""/0L0S(gs24.*)/story01.htm""", article.link) + s = s.group(1) + replacements = { "0B" : ".", "0C" : "/", "0H" : ",", "0I" : "_", "0D" : "?", "0F" : "="} + for (a, b) in replacements.iteritems(): + s = string.replace(s, a, b) + s = string.replace(s, "0A", "0") + return "http://"+s + + def print_version(self, url): + return url + "&Template=printpicart"