diff --git a/modules/750g/browser.py b/modules/750g/browser.py
index 5990861f..bbed397b 100644
--- a/modules/750g/browser.py
+++ b/modules/750g/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import RecipePage, ResultsPage
@@ -42,6 +42,9 @@ class SevenFiftyGramsBrowser(BaseBrowser):
return self.page.iter_recipes()
def get_recipe(self, id):
- self.location('http://www.750g.com/fiche_de_cuisine_complete.htm?recettes_id=%s' % id)
+ try:
+ self.location('http://www.750g.com/fiche_de_cuisine_complete.htm?recettes_id=%s' % id)
+ except BrowserHTTPNotFound:
+ return
if self.is_on_page(RecipePage):
return self.page.get_recipe(id)
diff --git a/modules/attilasub/browser.py b/modules/attilasub/browser.py
index 3e018868..c3537899 100644
--- a/modules/attilasub/browser.py
+++ b/modules/attilasub/browser.py
@@ -48,5 +48,5 @@ class AttilasubBrowser(BaseBrowser):
self.location('http://davidbillemont3.free.fr/%s' % url_end)
except BrowserHTTPNotFound:
return
- assert self.is_on_page(SubtitlesPage)
- return self.page.get_subtitle(id)
+ if self.is_on_page(SubtitlesPage):
+ return self.page.get_subtitle(id)
diff --git a/modules/btmon/browser.py b/modules/btmon/browser.py
index af987ce9..91926a89 100644
--- a/modules/btmon/browser.py
+++ b/modules/btmon/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import TorrentsPage, TorrentPage
@@ -42,6 +42,9 @@ class BtmonBrowser(BaseBrowser):
return self.page.iter_torrents()
def get_torrent(self, id):
- self.location('http://www.btmon.com/%s.html' % id)
+ try:
+ self.location('http://www.btmon.com/%s.html' % id)
+ except BrowserHTTPNotFound:
+ return
if self.is_on_page(TorrentPage):
return self.page.get_torrent()
diff --git a/modules/cuisineaz/browser.py b/modules/cuisineaz/browser.py
index 929429c1..2f85ea56 100644
--- a/modules/cuisineaz/browser.py
+++ b/modules/cuisineaz/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import RecipePage, ResultsPage
@@ -43,6 +43,9 @@ class CuisineazBrowser(BaseBrowser):
return self.page.iter_recipes()
def get_recipe(self, id):
- self.location('http://www.cuisineaz.com/recettes/%s.aspx' % id)
+ try:
+ self.location('http://www.cuisineaz.com/recettes/%s.aspx' % id)
+ except BrowserHTTPNotFound:
+ return
if self.is_on_page(RecipePage):
return self.page.get_recipe(id)
diff --git a/modules/isohunt/browser.py b/modules/isohunt/browser.py
index 1ab235d0..cf0fd475 100644
--- a/modules/isohunt/browser.py
+++ b/modules/isohunt/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages.torrents import TorrentsPage, TorrentPage
@@ -45,6 +45,9 @@ class IsohuntBrowser(BaseBrowser):
return self.page.iter_torrents()
def get_torrent(self, id):
- self.location('https://isohunt.com/torrent_details/%s/?tab=summary' % id)
+ try:
+ self.location('https://isohunt.com/torrent_details/%s/?tab=summary' % id)
+ except BrowserHTTPNotFound:
+ return
if self.is_on_page(TorrentPage):
return self.page.get_torrent(id)
diff --git a/modules/kickass/browser.py b/modules/kickass/browser.py
index 5cea0ac7..f7eb45e1 100644
--- a/modules/kickass/browser.py
+++ b/modules/kickass/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import TorrentsPage, TorrentPage
@@ -45,6 +45,9 @@ class KickassBrowser(BaseBrowser):
return self.page.iter_torrents()
def get_torrent(self, id):
- self.location('http://kat.ph/%s.html' % id)
- assert self.is_on_page(TorrentPage)
- return self.page.get_torrent(id)
+ try:
+ self.location('http://kat.ph/%s.html' % id)
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(TorrentPage):
+ return self.page.get_torrent(id)
diff --git a/modules/marmiton/browser.py b/modules/marmiton/browser.py
index ba234676..526cf913 100644
--- a/modules/marmiton/browser.py
+++ b/modules/marmiton/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import RecipePage, ResultsPage
@@ -42,6 +42,9 @@ class MarmitonBrowser(BaseBrowser):
return self.page.iter_recipes()
def get_recipe(self, id):
- self.location('http://www.marmiton.org/recettes/recette_%s.aspx' % id)
+ try:
+ self.location('http://www.marmiton.org/recettes/recette_%s.aspx' % id)
+ except BrowserHTTPNotFound:
+ return
if self.is_on_page(RecipePage):
return self.page.get_recipe(id)
diff --git a/modules/opensubtitles/browser.py b/modules/opensubtitles/browser.py
index 5a29a029..501daec1 100644
--- a/modules/opensubtitles/browser.py
+++ b/modules/opensubtitles/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-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()
diff --git a/modules/parolesmania/browser.py b/modules/parolesmania/browser.py
index e6f2b356..5c7adcf4 100644
--- a/modules/parolesmania/browser.py
+++ b/modules/parolesmania/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import SongResultsPage, SonglyricsPage, ArtistResultsPage, ArtistSongsPage
@@ -50,6 +50,9 @@ class ParolesmaniaBrowser(BaseBrowser):
def get_lyrics(self, id):
ids = id.split('|')
- self.location('http://www.parolesmania.com/paroles_%s/paroles_%s.html' % (ids[0], ids[1]))
- assert self.is_on_page(SonglyricsPage)
- return self.page.get_lyrics(id)
+ try:
+ self.location('http://www.parolesmania.com/paroles_%s/paroles_%s.html' % (ids[0], ids[1]))
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(SonglyricsPage):
+ return self.page.get_lyrics(id)
diff --git a/modules/parolesmusique/browser.py b/modules/parolesmusique/browser.py
index a4259054..b4a825c8 100644
--- a/modules/parolesmusique/browser.py
+++ b/modules/parolesmusique/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import SongResultsPage, SonglyricsPage, ArtistResultsPage, ArtistSongsPage, HomePage
@@ -45,6 +45,9 @@ class ParolesmusiqueBrowser(BaseBrowser):
return self.page.iter_lyrics(criteria, pattern)
def get_lyrics(self, id):
- self.location('http://www.paroles-musique.com/paroles-%s' % id)
- assert self.is_on_page(SonglyricsPage)
- return self.page.get_lyrics(id)
+ try:
+ self.location('http://www.paroles-musique.com/paroles-%s' % id)
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(SonglyricsPage):
+ return self.page.get_lyrics(id)
diff --git a/modules/piratebay/browser.py b/modules/piratebay/browser.py
index e621c9a0..1f8ad9be 100644
--- a/modules/piratebay/browser.py
+++ b/modules/piratebay/browser.py
@@ -20,7 +20,7 @@
import urllib
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages.index import IndexPage
from .pages.torrents import TorrentsPage, TorrentPage
@@ -49,6 +49,9 @@ class PiratebayBrowser(BaseBrowser):
return self.page.iter_torrents()
def get_torrent(self, id):
- self.location('https://thepiratebay.se/torrent/%s/' % id)
- assert self.is_on_page(TorrentPage)
- return self.page.get_torrent(id)
+ try:
+ self.location('https://thepiratebay.se/torrent/%s/' % id)
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(TorrentPage):
+ return self.page.get_torrent(id)
diff --git a/modules/seeklyrics/browser.py b/modules/seeklyrics/browser.py
index 22c04775..79f6b126 100644
--- a/modules/seeklyrics/browser.py
+++ b/modules/seeklyrics/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import SongResultsPage, SonglyricsPage, ArtistResultsPage, ArtistSongsPage
@@ -48,6 +48,9 @@ class SeeklyricsBrowser(BaseBrowser):
return self.page.iter_lyrics()
def get_lyrics(self, id):
- self.location('http://www.seeklyrics.com/lyrics/%s.html' % id)
- assert self.is_on_page(SonglyricsPage)
- return self.page.get_lyrics(id)
+ try:
+ self.location('http://www.seeklyrics.com/lyrics/%s.html' % id)
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(SonglyricsPage):
+ return self.page.get_lyrics(id)
diff --git a/modules/tvsubtitles/browser.py b/modules/tvsubtitles/browser.py
index 73c1714a..078f4c40 100644
--- a/modules/tvsubtitles/browser.py
+++ b/modules/tvsubtitles/browser.py
@@ -18,7 +18,7 @@
# along with weboob. If not, see .
-from weboob.tools.browser import BaseBrowser
+from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound
from .pages import SeriePage, SearchPage, SeasonPage, HomePage
@@ -48,6 +48,9 @@ class TvsubtitlesBrowser(BaseBrowser):
return self.page.iter_subtitles(language, pattern)
def get_subtitle(self, id):
- self.location('http://www.tvsubtitles.net/subtitle-%s.html' % id)
- assert self.is_on_page(SeasonPage)
- return self.page.get_subtitle()
+ try:
+ self.location('http://www.tvsubtitles.net/subtitle-%s.html' % id)
+ except BrowserHTTPNotFound:
+ return
+ if self.is_on_page(SeasonPage):
+ return self.page.get_subtitle()
diff --git a/weboob/applications/qcineoob/main_window.py b/weboob/applications/qcineoob/main_window.py
index ae94e0ac..26c728c1 100644
--- a/weboob/applications/qcineoob/main_window.py
+++ b/weboob/applications/qcineoob/main_window.py
@@ -28,7 +28,6 @@ from weboob.capabilities.torrent import ICapTorrent
from weboob.capabilities.subtitle import ICapSubtitle
from weboob.tools.application.qt import QtMainWindow, QtDo
from weboob.tools.application.qt.backendcfg import BackendCfg
-from weboob.tools.browser import BrowserHTTPNotFound, BrokenPageError
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from weboob.applications.qcineoob.ui.main_window_ui import Ui_MainWindow
@@ -406,10 +405,7 @@ class MainWindow(QtMainWindow):
backend_name = None
for backend in self.weboob.iter_backends():
if backend.has_caps(cap) and ((backend_name and backend.name == backend_name) or not backend_name):
- try:
- exec('object = backend.get_%s(id)' % (stype))
- except (BrowserHTTPNotFound, BrokenPageError):
- object = None
+ exec('object = backend.get_%s(id)' % (stype))
if object:
func_display = 'self.display' + stype[0].upper() + stype[1:]
exec("self.doAction('Details of %s \"%%s\"' %% object.%s, %s, [object, backend])" %
diff --git a/weboob/applications/qcookboob/main_window.py b/weboob/applications/qcookboob/main_window.py
index 85d96e1e..d2bb00df 100644
--- a/weboob/applications/qcookboob/main_window.py
+++ b/weboob/applications/qcookboob/main_window.py
@@ -26,7 +26,6 @@ from PyQt4.QtGui import QApplication, QCompleter
from weboob.capabilities.recipe import ICapRecipe
from weboob.tools.application.qt import QtMainWindow, QtDo
from weboob.tools.application.qt.backendcfg import BackendCfg
-from weboob.tools.browser import BrowserHTTPNotFound, BrokenPageError
from weboob.applications.qcookboob.ui.main_window_ui import Ui_MainWindow
@@ -202,10 +201,7 @@ class MainWindow(QtMainWindow):
backend_name = None
for backend in self.weboob.iter_backends():
if (backend_name and backend.name == backend_name) or not backend_name:
- try:
- recipe = backend.get_recipe(id)
- except (BrowserHTTPNotFound, BrokenPageError):
- recipe = None
+ recipe = backend.get_recipe(id)
if recipe:
self.doAction('Details of recipe "%s"' % recipe.title, self.displayRecipe, [recipe, backend])
QApplication.restoreOverrideCursor()