diff --git a/modules/750g/browser.py b/modules/750g/browser.py index 333037b0..7f787acd 100644 --- a/modules/750g/browser.py +++ b/modules/750g/browser.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . - +from weboob.browser.exceptions import BrowserHTTPNotFound from weboob.browser import PagesBrowser, URL from .pages import RecipePage, ResultsPage @@ -35,8 +35,11 @@ class SevenFiftyGramsBrowser(PagesBrowser): return self.search.go(pattern=pattern.replace(' ', '_')).iter_recipes() def get_recipe(self, id, recipe=None): - recipe = self.recipe.go(id=id).get_recipe(obj=recipe) - comments = list(self.page.get_comments()) - if comments: - recipe.comments = comments - return recipe + try: + recipe = self.recipe.go(id=id).get_recipe(obj=recipe) + comments = list(self.page.get_comments()) + if comments: + recipe.comments = comments + return recipe + except BrowserHTTPNotFound: + return diff --git a/modules/750g/test.py b/modules/750g/test.py index 2f0e32bb..29e8a561 100644 --- a/modules/750g/test.py +++ b/modules/750g/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest import itertools + class SevenFiftyGramsTest(BackendTest): MODULE = '750g' diff --git a/modules/marmiton/browser.py b/modules/marmiton/browser.py index 03c11966..2c297c6c 100644 --- a/modules/marmiton/browser.py +++ b/modules/marmiton/browser.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . - +from weboob.browser.exceptions import BrowserHTTPNotFound from weboob.browser import PagesBrowser, URL from .pages import RecipePage, ResultsPage @@ -35,8 +35,11 @@ class MarmitonBrowser(PagesBrowser): return self.search.go(pattern=pattern).iter_recipes() def get_recipe(self, id, recipe=None): - recipe = self.recipe.go(id=id).get_recipe(obj=recipe) - comments = list(self.page.get_comments()) - if comments: - recipe.comments = comments - return recipe + try: + recipe = self.recipe.go(id=id).get_recipe(obj=recipe) + comments = list(self.page.get_comments()) + if comments: + recipe.comments = comments + return recipe + except BrowserHTTPNotFound: + return diff --git a/modules/marmiton/module.py b/modules/marmiton/module.py index 42b389b1..9a0ed10a 100644 --- a/modules/marmiton/module.py +++ b/modules/marmiton/module.py @@ -43,7 +43,7 @@ class MarmitonModule(Module, CapRecipe): return self.browser.iter_recipes(quote_plus(pattern.encode('utf-8'))) def fill_recipe(self, recipe, fields): - if 'nb_person' in fields or 'instructions' in fields: + if 'nb_person' in fields or 'instructions' in fields or 'thumbnail_url' in fields: recipe = self.browser.get_recipe(recipe.id, recipe) return recipe diff --git a/modules/marmiton/pages.py b/modules/marmiton/pages.py index 010dbb69..1335d5dc 100644 --- a/modules/marmiton/pages.py +++ b/modules/marmiton/pages.py @@ -42,7 +42,6 @@ class ResultsPage(HTMLPage): obj_id = Regexp(CleanText('./div/div[@class="m_titre_resultat"]/a/@href'), '/recettes/recette_(.*).aspx') obj_title = CleanText('./div/div[@class="m_titre_resultat"]/a') - obj_thumbnail_url = CleanText('./a[@class="m_resultat_lien_image"]', default='') obj_short_description = Format('%s. %s', CleanText('./div/div[@class="m_detail_recette"]'), CleanText('./div/div[@class="m_texte_resultat"]')) @@ -71,7 +70,8 @@ class RecipePage(HTMLPage): return ingredients[1:] obj_instructions = CleanHTML('//div[@class="m_content_recette_todo"]') - obj_picture_url = CleanText('//a[@class="m_content_recette_illu"]/@href', default=NotAvailable) + obj_thumbnail_url = CleanText('//a[@class="m_content_recette_illu"]/img/@src', default=NotAvailable) + obj_picture_url = CleanText('//a[@class="m_content_recette_illu"]/img/@src', default=NotAvailable) @method class get_comments(ListElement): diff --git a/modules/marmiton/test.py b/modules/marmiton/test.py index c7964b14..ee0bfb55 100644 --- a/modules/marmiton/test.py +++ b/modules/marmiton/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest import itertools + class MarmitonTest(BackendTest): MODULE = 'marmiton'