From a4082773adc590a68b36d3916ee16a999e9fc2cf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Dec 2009 12:06:14 -0700 Subject: [PATCH] New recipes: Golem, Netzpolitik by KG and Nu.nl by Rob Hankel --- resources/recipes/golem_de.recipe | 17 ++++++++ resources/recipes/netzpolitik.recipe | 14 ++++++ resources/recipes/nu.recipe | 53 +++++++++++++++++++++++ src/calibre/gui2/dialogs/user_profiles.py | 2 +- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 resources/recipes/golem_de.recipe create mode 100644 resources/recipes/netzpolitik.recipe create mode 100644 resources/recipes/nu.recipe diff --git a/resources/recipes/golem_de.recipe b/resources/recipes/golem_de.recipe new file mode 100644 index 0000000000..d0280a9617 --- /dev/null +++ b/resources/recipes/golem_de.recipe @@ -0,0 +1,17 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1257093338(BasicNewsRecipe): + title = u'Golem.de' + language = 'de' + __author__ = 'Kovid Goyal' + oldest_article = 7 + max_articles_per_feed = 100 + + feeds = [(u'Golem.de', u'http://rss.golem.de/rss.php?feed=ATOM1.0')] + + def print_version(self, url): + murxb = url.rfind('/') + 1 + murxc = url[murxb :-5] + murxa = 'http://www.golem.de/' + 'print.php?a=' + murxc + return murxa + diff --git a/resources/recipes/netzpolitik.recipe b/resources/recipes/netzpolitik.recipe new file mode 100644 index 0000000000..52d3c57f39 --- /dev/null +++ b/resources/recipes/netzpolitik.recipe @@ -0,0 +1,14 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class BasicUserRecipe1257093186(BasicNewsRecipe): + title = u'Netzpolitik' + oldest_article = 14 + language = 'de' + no_stylesheets = True + __author__ = 'Kovid Goyal' + max_articles_per_feed = 100 + remove_tags = [dict(id=['respond', 'ackt', 'nav', 'commentblock', + 'l_sidebar', 'r_sidebar']), dict(attrs={'class':['widgettitle', + 'bt-links', 'navigation']})] + + feeds = [(u'Netzpolitik.org', u'http://www.netzpolitik.org/feed/')] diff --git a/resources/recipes/nu.recipe b/resources/recipes/nu.recipe new file mode 100644 index 0000000000..782193b55c --- /dev/null +++ b/resources/recipes/nu.recipe @@ -0,0 +1,53 @@ +__license__ = 'GPL v3' +__copyright__ = '2009, Rob Hankel ' +''' +nu.nl +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Nu(BasicNewsRecipe): + title = u'Nu.nl' + __author__ = u'Rob Hankel' + + publisher = 'nu.nl' + description = u'Dutch News' + category = 'news' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'utf-8' + remove_javascript = True + language = 'nl' + + keep_only_tags = [dict(name='div' , attrs={'id':['leadarticle']})] + + feeds = [(u'binnenland', u'http://www.nu.nl/feeds/rss/binnenland.rss'), + (u'Algemeen nieuws', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Algemeen'), + (u'Economie', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Economie'), + (u'Internet', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Internet'), + (u'Sport', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Sport'), + (u'Achterklap', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Achterklap'), + (u'Opmerkelijk', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Opmerkelijk'), + (u'Muziek', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Muziek'), + (u'DVD', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=DVD'), + (u'Film', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Film'), + (u'Boek', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Boek'), + (u'Games', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Games'), + (u'Columns', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Columns'), + (u'Cartoon', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Cartoon'), + (u'Lifehacking', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Lifehacking'), + (u'Jurryt', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Jurryt'), + (u'Formule 1', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Formule1'), + (u'Plugged', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Plugged'), + (u'Auto', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Auto'), + (u'Wetenschap', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Wetenschap'), + (u'Gezondheid', u'http://www.nu.nl/deeplink_rss2/index.jsp?r=Gezondheid'), + (u'Dagelijkse tv-tips', u'http://www.nu.nl/tvgids/rss/tips'), + (u'Podcast Algemeen nieuws', u'http://www.nu.nl/podcast.php')] + + + def get_article_url(self, article): + return article.get('guid', None) + diff --git a/src/calibre/gui2/dialogs/user_profiles.py b/src/calibre/gui2/dialogs/user_profiles.py index 86449a34e7..bd332c2aa3 100644 --- a/src/calibre/gui2/dialogs/user_profiles.py +++ b/src/calibre/gui2/dialogs/user_profiles.py @@ -126,7 +126,7 @@ class UserProfiles(ResizableDialog, Ui_Dialog): if not title or not src: error_dialog(self, _('No recipe selected'), _('No recipe selected')).exec_() return - pt = PersistentTemporaryFile(suffix='.py') + pt = PersistentTemporaryFile(suffix='.recipe') pt.write(src.encode('utf-8')) pt.close() body = _('The attached file: %s is a recipe to download %s.')%(os.path.basename(pt.name), title)