# -*- coding: utf-8 -*- # Copyright 2026 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://compare.bakashots.me/""" from .common import GalleryExtractor, Extractor, Message from .. import text, util BASE_PATTERN = r"(?:https?://)?compare\.bakashots\.me" class BakashotsExtractor(Extractor): """Base class for bakashots extractors""" category = "bakashots" root = "https://compare.bakashots.me" class BakashotsComparisonExtractor(GalleryExtractor, BakashotsExtractor): """Extractor for bakashots comparisons""" subcategory = "comparison" directory_fmt = ("{category}", "{set_id} {title}") filename_fmt = "{num:>02}.{extension}" archive_fmt = "{set_id}_{num}" pattern = BASE_PATTERN + r"(/compare\.php\?setId=(\d+))" example = "https://compare.bakashots.me/compare.php?setId=12345" def metadata(self, page): extr = text.extract_from(page) self.data = util.json_loads(extr("var G_imageLists =", ";\n")) return { "set_id": text.parse_int(self.groups[1]), "title" : text.unescape(extr("