diff --git a/recipes/descopera_org.recipe b/recipes/descopera_org.recipe index c76e88a588..c24046da12 100644 --- a/recipes/descopera_org.recipe +++ b/recipes/descopera_org.recipe @@ -1,27 +1,27 @@ -# -*- coding: utf-8 -*- -''' -descopera.org -''' - -from calibre.web.feeds.news import BasicNewsRecipe - -class Descopera(BasicNewsRecipe): - title = u'Descoperă.org' - __author__ = 'Marius Ignătescu' - description = 'Descoperă. Placerea de a cunoaște' - publisher = 'descopera.org' - category = 'science, technology, culture, history, earth' - language = 'ro' - oldest_article = 14 - max_articles_per_feed = 100 - encoding = 'utf8' - no_stylesheets = True - extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} ' - keep_only_tags = [dict(name='div', attrs={'class':['post']})] - remove_tags = [dict(name='div', attrs={'class':['topnav', 'box_a', 'shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge']})] - remove_attributes = ['width','height'] - cover_url = 'http://www.descopera.org/wp-content/themes/dorg/styles/default/img/b_top.png?width=400' - feeds = [(u'Articles', u'http://www.descopera.org/feed/')] - - def preprocess_html(self, soup): - return self.adeify_images(soup) +# -*- coding: utf-8 -*- +''' +descopera.org +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Descopera(BasicNewsRecipe): + title = u'Descoperă.org' + __author__ = 'Marius Ignătescu' + description = 'Descoperă. Placerea de a cunoaște' + publisher = 'descopera.org' + category = 'science, technology, culture, history, earth' + language = 'ro' + oldest_article = 14 + max_articles_per_feed = 100 + encoding = 'utf8' + no_stylesheets = True + extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} ' + keep_only_tags = [dict(name='div', attrs={'class':['post']})] + remove_tags = [dict(name='div', attrs={'class':['topnav', 'box_a', 'shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge']})] + remove_attributes = ['width','height'] + cover_url = 'http://www.descopera.org/wp-content/themes/dorg/styles/default/img/b_top.png?width=400' + feeds = [(u'Articles', u'http://www.descopera.org/feed/')] + + def preprocess_html(self, soup): + return self.adeify_images(soup) diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 46d6c2db81..e94001bf13 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -79,7 +79,12 @@ def serialize_builtin_recipes(): from calibre.web.feeds.recipes import compile_recipe recipe_mapping = {} for rid, f in iterate_over_builtin_recipe_files(): - recipe_class = compile_recipe(open(f, 'rb').read()) + with open(f, 'rb') as stream: + try: + recipe_class = compile_recipe(stream.read()) + except: + print ('Failed to compile: %s'%f) + raise if recipe_class is not None: recipe_mapping['builtin:'+rid] = recipe_class