From 68beb72bbde29fdb482dfb8c3addbb28eed32d8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Jan 2010 20:42:21 -0700 Subject: [PATCH] ... --- resources/recipes/kidney.recipe | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/recipes/kidney.recipe b/resources/recipes/kidney.recipe index cc37954ab3..19fd244675 100644 --- a/resources/recipes/kidney.recipe +++ b/resources/recipes/kidney.recipe @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- + +import time + from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup @@ -8,6 +11,7 @@ class JASN(BasicNewsRecipe): __author__ = 'Krittika Goyal' oldest_article = 31 #days max_articles_per_feed = 25 + delay = 5 needs_subscription = True INDEX = 'http://jasn.asnjournals.org/current.shtml' @@ -102,9 +106,17 @@ class JASN(BasicNewsRecipe): continue if url.startswith('/'): url = 'http://jasn.asnjournals.org'+url - isoup = self.index_to_soup(url) - img = isoup.find('img', src=lambda x: x and - x.startswith('/content/')) + img = isoup = None + try: + isoup = self.index_to_soup(url) + except: + time.sleep(5) + try: + isoup = self.index_to_soup(url) + except: + continue + img = isoup.find('img', src=lambda x: x and x.startswith('/content/')) + if img is not None: img.extract() table = a.findParent('table')