diff options
Diffstat (limited to 'gallery_dl/extractor/shimmie2.py')
| -rw-r--r-- | gallery_dl/extractor/shimmie2.py | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/gallery_dl/extractor/shimmie2.py b/gallery_dl/extractor/shimmie2.py index a68f0db..97bad09 100644 --- a/gallery_dl/extractor/shimmie2.py +++ b/gallery_dl/extractor/shimmie2.py @@ -69,11 +69,6 @@ class Shimmie2Extractor(BaseExtractor): BASE_PATTERN = Shimmie2Extractor.update({ - "loudbooru": { - "root": "https://loudbooru.com", - "pattern": r"loudbooru\.com", - "cookies": {"ui-tnc-agreed": "true"}, - }, "giantessbooru": { "root": "https://sizechangebooru.com", "pattern": r"(?:sizechange|giantess)booru\.com", @@ -104,20 +99,15 @@ class Shimmie2TagExtractor(Shimmie2Extractor): subcategory = "tag" directory_fmt = ("{category}", "{search_tags}") file_url_fmt = "{}/_images/{}/{}%20-%20{}.{}" - pattern = BASE_PATTERN + r"post/list/([^/?#]+)(?:/(\d+))?()" - example = "https://loudbooru.com/post/list/TAG/1" - - def __init__(self, match): - Shimmie2Extractor.__init__(self, match) - lastindex = match.lastindex - self.tags = text.unquote(match.group(lastindex-2)) - self.page = match.group(lastindex-1) + pattern = BASE_PATTERN + r"post/list/([^/?#]+)(?:/(\d+))?" + example = "https://vidya.pics/post/list/TAG/1" def metadata(self): + self.tags = text.unquote(self.groups[-2]) return {"search_tags": self.tags} def posts(self): - pnum = text.parse_int(self.page, 1) + pnum = text.parse_int(self.groups[-1], 1) file_url_fmt = self.file_url_fmt.format init = True @@ -171,7 +161,7 @@ class Shimmie2TagExtractor(Shimmie2Extractor): return def _posts_giantessbooru(self): - pnum = text.parse_int(self.page, 1) + pnum = text.parse_int(self.groups[-1], 1) file_url_fmt = (self.root + "/index.php?q=/image/{}.jpg").format while True: @@ -206,20 +196,17 @@ class Shimmie2PostExtractor(Shimmie2Extractor): """Extractor for single shimmie2 posts""" subcategory = "post" pattern = BASE_PATTERN + r"post/view/(\d+)" - example = "https://loudbooru.com/post/view/12345" - - def __init__(self, match): - Shimmie2Extractor.__init__(self, match) - self.post_id = match.group(match.lastindex) + example = "https://vidya.pics/post/view/12345" def posts(self): - url = "{}/post/view/{}".format(self.root, self.post_id) + post_id = self.groups[-1] + url = "{}/post/view/{}".format(self.root, post_id) page = self.request(url).text extr = text.extract_from(page) quote = self._quote_type(page) post = { - "id" : self.post_id, + "id" : post_id, "tags" : extr(": ", "<").partition(" - ")[0].rstrip(")"), "md5" : extr("/_thumbs/", "/"), "file_url": self.root + ( @@ -237,12 +224,12 @@ class Shimmie2PostExtractor(Shimmie2Extractor): return (post,) def _posts_giantessbooru(self): - url = "{}/index.php?q=/post/view/{}".format( - self.root, self.post_id) + post_id = self.groups[-1] + url = "{}/index.php?q=/post/view/{}".format(self.root, post_id) extr = text.extract_from(self.request(url).text) return ({ - "id" : self.post_id, + "id" : post_id, "tags" : extr(": ", "<").partition(" - ")[0].rstrip(")"), "md5" : "", "file_url": self.root + extr("id='main_image' src='.", "'"), |
