From 9ca6117c67a8305fd02c0960dc7bed9c26754d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 20 Jan 2024 02:53:44 +0100 Subject: [PATCH] [hbrowse] remove module website gone --- docs/supportedsites.md | 6 --- gallery_dl/extractor/hbrowse.py | 92 --------------------------------- test/results/hbrowse.py | 28 ---------- 3 files changed, 126 deletions(-) delete mode 100644 gallery_dl/extractor/hbrowse.py delete mode 100644 test/results/hbrowse.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 4da570e8..c6756c6a 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -271,12 +271,6 @@ Consider all listed sites to potentially be NSFW. Archive, Individual Posts, Home Feed, Search Results - - HBrowse - https://www.hbrowse.com/ - Chapters, Manga - - Hentai Cosplay https://hentai-cosplays.com/ diff --git a/gallery_dl/extractor/hbrowse.py b/gallery_dl/extractor/hbrowse.py deleted file mode 100644 index a5221409..00000000 --- a/gallery_dl/extractor/hbrowse.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015-2023 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 -# published by the Free Software Foundation. - -"""Extractors for https://www.hbrowse.com/""" - -from .common import ChapterExtractor, MangaExtractor -from .. import text, util, exception - - -class HbrowseBase(): - """Base class for hbrowse extractors""" - category = "hbrowse" - root = "https://www.hbrowse.com" - - def parse_page(self, page, data): - """Parse metadata on 'page' and add it to 'data'""" - data, pos = text.extract_all(page, ( - ('manga' , '', ''), - ('artist', '', ''), - ('total' , '', ' '), - ('origin', '', ''), - ), values=data) - - if not data["manga"] and "Warning" in page: - msg = page.rpartition(">")[2].strip() - raise exception.StopExtraction("Site is not accessible: '%s'", msg) - - tags = text.extract(page, 'class="listTable"', '', pos)[0] - - data["manga"] = text.unescape(data["manga"]) - data["total"] = text.parse_int(data["total"]) - data["artist"] = text.remove_html(data["artist"]) - data["origin"] = text.remove_html(data["origin"]) - data["tags"] = list(text.extract_iter(tags, 'href="/browse/', '"')) - return data - - -class HbrowseChapterExtractor(HbrowseBase, ChapterExtractor): - """Extractor for manga-chapters from hbrowse.com""" - directory_fmt = ("{category}", "{manga_id} {manga}", "c{chapter:>05}") - filename_fmt = ("{category}_{manga_id}_{chapter:>05}_" - "{page:>03}.{extension}") - archive_fmt = "{manga_id}_{chapter}_{page}" - pattern = r"(?:https?://)?(?:www\.)?hbrowse\.com(/(\d+)/c(\d+))" - example = "https://www.hbrowse.com/12345/c00000" - - def __init__(self, match): - self.path, self.gid, self.chapter = match.groups() - self.path += "/" - ChapterExtractor.__init__(self, match) - - def metadata(self, page): - return self.parse_page(page, { - "manga_id": text.parse_int(self.gid), - "chapter": text.parse_int(self.chapter) - }) - - def images(self, page): - base = self.root + "/data" + self.path - json_data = text.extract(page, ';list = ', ',"zzz"')[0] + "]" - return [(base + name, None) for name in util.json_loads(json_data)] - - -class HbrowseMangaExtractor(HbrowseBase, MangaExtractor): - """Extractor for manga from hbrowse.com""" - chapterclass = HbrowseChapterExtractor - reverse = False - pattern = r"(?:https?://)?(?:www\.)?hbrowse\.com(/\d+)/?$" - example = "https://www.hbrowse.com/12345" - - def chapters(self, page): - results = [] - data = self.parse_page(page, { - "manga_id": text.parse_int( - self.manga_url.rstrip("/").rpartition("/")[2]) - }) - - pos = 0 - needle = '\nView ', '<', pos) - data["chapter"] = text.parse_int(url.rpartition("/")[2][1:]) - data["title"] = title - results.append((text.urljoin(self.root, url), data.copy())) diff --git a/test/results/hbrowse.py b/test/results/hbrowse.py deleted file mode 100644 index c4b3dcd6..00000000 --- a/test/results/hbrowse.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -# 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 -# published by the Free Software Foundation. - -from gallery_dl.extractor import hbrowse - - -__tests__ = ( -{ - "#url" : "https://www.hbrowse.com/10363/c00000", - "#category": ("", "hbrowse", "chapter"), - "#class" : hbrowse.HbrowseChapterExtractor, - "#sha1_url" : "6feefbc9f4b98e20d8425ddffa9dd111791dc3e6", - "#sha1_metadata": "274996f6c809e5250b6ff3abbc5147e29f89d9a5", - "#sha1_content" : "44578ebbe176c2c27434966aef22945787e2781e", -}, - -{ - "#url" : "https://www.hbrowse.com/10363", - "#category": ("", "hbrowse", "manga"), - "#class" : hbrowse.HbrowseMangaExtractor, - "#sha1_url" : "b89682bfb86c11d2af0dc47463804ec3ac4aadd6", - "#sha1_metadata": "4b15fda1858a69de1fbf5afddfe47dd893397312", -}, - -)