From d7a4739cf652c8b715f55000cf98c1236a031031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 14 Jan 2019 15:44:23 +0100 Subject: [PATCH] [hbrowse] print error message if site is down ... instead of crashing with a meaningless exception --- gallery_dl/extractor/hbrowse.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gallery_dl/extractor/hbrowse.py b/gallery_dl/extractor/hbrowse.py index f1f04ed2..e67fecc9 100644 --- a/gallery_dl/extractor/hbrowse.py +++ b/gallery_dl/extractor/hbrowse.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2018 Mike Fährmann +# Copyright 2015-2019 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -9,7 +9,7 @@ """Extract images from http://www.hbrowse.com/""" from .common import ChapterExtractor, MangaExtractor -from .. import text +from .. import text, exception import json @@ -18,8 +18,7 @@ class HbrowseExtractor(): category = "hbrowse" root = "http://www.hbrowse.com" - @staticmethod - def parse_page(page, data): + def parse_page(self, page, data): """Parse metadata on 'page' and add it to 'data'""" text.extract_all(page, ( ('manga' , '', ''), @@ -28,6 +27,11 @@ class HbrowseExtractor(): ('origin', '', ''), ), values=data) + if not data["manga"] and "Warning" in page: + msg = page.rpartition(">")[2].strip() + self.log.error("Site is not accessible: '%s'", msg) + raise exception.StopExtraction() + data["manga"] = text.unescape(data["manga"]) data["total"] = text.parse_int(data["total"]) data["artist"] = text.remove_html(data["artist"])