From 92027f67f9fd284c0b6701728a7a700c03ad53eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 6 Nov 2017 20:56:49 +0100 Subject: [PATCH] use consistent names for URL constants root := :// base_url := / --- gallery_dl/extractor/dynastyscans.py | 10 +++++----- gallery_dl/extractor/hentaifoundry.py | 17 ++++++++--------- gallery_dl/extractor/imagebam.py | 6 +++--- gallery_dl/extractor/imgbox.py | 6 +++--- gallery_dl/extractor/imgchili.py | 4 ++-- gallery_dl/extractor/senmanga.py | 10 +++++----- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/gallery_dl/extractor/dynastyscans.py b/gallery_dl/extractor/dynastyscans.py index 03820b86..e822a502 100644 --- a/gallery_dl/extractor/dynastyscans.py +++ b/gallery_dl/extractor/dynastyscans.py @@ -26,23 +26,23 @@ class DynastyscansChapterExtractor(Extractor): test = [ (("http://dynasty-scans.com/chapters/" "hitoribocchi_no_oo_seikatsu_ch33"), { - "url": "ff79ea9956522a8dafd261c1fbe3c74aa8470dc5", + "url": "dce64e8c504118f1ab4135c00245ea12413896cb", "keyword": "fb2f470b995df5b301ccede31ed9829a010236db", }), (("http://dynasty-scans.com/chapters/" "new_game_the_spinoff_special_13"), { - "url": "2cd5e04bd16f842dc884c145a44cf0c64ec27a21", + "url": "dbe5bbb74da2edcfb1832895a484e2a40bc8b538", "keyword": "281bbe0fb74b812ced595619ca5876983490dc0e", }), ] - url_base = "https://dynasty-scans.com/" + root = "https://dynasty-scans.com" def __init__(self, match): Extractor.__init__(self) self.chaptername = match.group(1) def items(self): - page = self.request(self.url_base + "chapters/" + self.chaptername, + page = self.request(self.root + "/chapters/" + self.chaptername, encoding="utf-8").text data = self.get_job_metadata(page) imgs = self.get_image_data(page) @@ -50,7 +50,7 @@ class DynastyscansChapterExtractor(Extractor): yield Message.Version, 1 yield Message.Directory, data for data["page"], img in enumerate(imgs, 1): - url = self.url_base + img["image"] + url = self.root + img["image"] text.nameext_from_url(url, data) data["name"] = img["name"] yield Message.Url, url, data diff --git a/gallery_dl/extractor/hentaifoundry.py b/gallery_dl/extractor/hentaifoundry.py index 2d4cc8bb..f9c334d7 100644 --- a/gallery_dl/extractor/hentaifoundry.py +++ b/gallery_dl/extractor/hentaifoundry.py @@ -29,7 +29,7 @@ class HentaifoundryUserExtractor(Extractor): "exception": exception.NotFoundError, }), ] - url_base = "https://www.hentai-foundry.com/pictures/user/" + base_url = "https://www.hentai-foundry.com/pictures/user/" def __init__(self, match): Extractor.__init__(self) @@ -50,18 +50,18 @@ class HentaifoundryUserExtractor(Extractor): needle = 'thumbTitle"> » ', '<') - url, pos = text.extract( + part, pos = text.extract( page, '//pictures.hentai-foundry.com', '"', pos) data = {"index": util.safe_int(index), "title": text.unescape(title)} - text.nameext_from_url(url, data) - return "https://pictures.hentai-foundry.com" + url, data + text.nameext_from_url(part, data) + return "https://pictures.hentai-foundry.com" + part, data def set_filters(self, token): """Set site-internal filters to show all images""" diff --git a/gallery_dl/extractor/imagebam.py b/gallery_dl/extractor/imagebam.py index 71f77dbc..276e9055 100644 --- a/gallery_dl/extractor/imagebam.py +++ b/gallery_dl/extractor/imagebam.py @@ -25,7 +25,7 @@ class ImagebamGalleryExtractor(AsynchronousExtractor): "keyword": "0ab7bef5cf995d9229dc900dc508311cefb32306", "content": "596e6bfa157f2c7169805d50075c2986549973a8", })] - url_base = "http://www.imagebam.com" + root = "http://www.imagebam.com" def __init__(self, match): AsynchronousExtractor.__init__(self) @@ -44,7 +44,7 @@ class ImagebamGalleryExtractor(AsynchronousExtractor): def get_job_metadata(self): """Collect metadata for extractor-job""" - url = self.url_base + "/gallery/" + self.gkey + url = self.root + "/gallery/" + self.gkey page = self.request(url, encoding="utf-8").text data, pos = text.extract_all(page, ( (None , "', '' )[1] diff --git a/gallery_dl/extractor/imgbox.py b/gallery_dl/extractor/imgbox.py index 6888b1b7..4532ce60 100644 --- a/gallery_dl/extractor/imgbox.py +++ b/gallery_dl/extractor/imgbox.py @@ -16,7 +16,7 @@ import re class ImgboxExtractor(Extractor): """Base class for imgbox extractors""" category = "imgbox" - url_base = "https://imgbox.com" + root = "https://imgbox.com" def items(self): data = self.get_job_metadata() @@ -24,7 +24,7 @@ class ImgboxExtractor(Extractor): yield Message.Directory, data for image_key in self.get_image_keys(): - imgpage = self.request(self.url_base + "/" + image_key).text + imgpage = self.request(self.root + "/" + image_key).text imgdata = self.get_image_metadata(imgpage) if imgdata["filename"]: imgdata.update(data) @@ -85,7 +85,7 @@ class ImgboxGalleryExtractor(AsynchronousExtractor, ImgboxExtractor): self.image_keys = [] def get_job_metadata(self): - page = self.request(self.url_base + "/g/" + self.gallery_key).text + page = self.request(self.root + "/g/" + self.gallery_key).text if "The specified gallery could not be found." in page: raise exception.NotFoundError("gallery") self.image_keys = re.findall(r'