finaly handle BrowserHTTPNotFound in backend browsers

This commit is contained in:
Julien Veyssier 2013-03-17 21:54:08 +01:00
commit 8d49950813
15 changed files with 78 additions and 50 deletions

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BaseBrowser
from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from .pages import SubtitlesPage, SearchPage, SubtitlePage
@ -47,6 +47,9 @@ class OpensubtitlesBrowser(BaseBrowser):
return self.page.iter_subtitles()
def get_subtitle(self, id):
self.location('http://www.opensubtitles.org/subtitles/%s' % id)
assert self.is_on_page(SubtitlePage)
return self.page.get_subtitle()
try:
self.location('http://www.opensubtitles.org/subtitles/%s' % id)
except BrowserHTTPNotFound:
return
if self.is_on_page(SubtitlePage):
return self.page.get_subtitle()