From 0c4405b4c3fb407e3777701e4c01046841001b2f Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Mon, 13 Apr 2015 11:06:26 +0200 Subject: [PATCH] [rmll] do not crash when videoob try to enter in a directory not available on rmll website --- modules/rmll/browser.py | 16 ++++++++++------ modules/rmll/module.py | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/rmll/browser.py b/modules/rmll/browser.py index 5478cbc6..eb1036f2 100644 --- a/modules/rmll/browser.py +++ b/modules/rmll/browser.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . from weboob.browser import PagesBrowser, URL - +from weboob.browser.exceptions import HTTPNotFound from .pages import RmllCollectionPage, RmllVideoPage, RmllChannelsPage, RmllSearchPage, RmllLatestPage __all__ = ['RmllBrowser'] @@ -59,9 +59,13 @@ class RmllBrowser(PagesBrowser): oid = '' if len(split_path) > 0: oid = split_path[-1] - url = self.channels_page.build(oid=oid) - self.location(url) - assert self.channels_page.is_here() - for video in self.page.iter_resources(split_path): - yield video + try: + url = self.channels_page.build(oid=oid) + self.location(url) + assert self.channels_page.is_here() + for video in self.page.iter_resources(split_path): + yield video + + except HTTPNotFound: + pass diff --git a/modules/rmll/module.py b/modules/rmll/module.py index 9fda5553..bc19c66a 100644 --- a/modules/rmll/module.py +++ b/modules/rmll/module.py @@ -67,7 +67,9 @@ class RmllModule(Module, CapVideo, CapCollection): for video in self.browser.get_latest_videos(): yield video else: - for content in self.browser.get_channel_videos(split_path): - yield content + channel_videos = self.browser.get_channel_videos(split_path) + if channel_videos: + for content in channel_videos: + yield content OBJECTS = {RmllVideo: fill_video}