# -*- coding: utf-8 -*- # Copyright 2022-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://bunkr.sk/""" from .lolisafe import LolisafeAlbumExtractor from .. import text BASE_PATTERN = ( r"(?:https?://)?(?:app\.)?(bunkr+" r"\.(?:s[kiu]|ru|la|is|to|ac|black|cat|media|red|site|ws))" ) LEGACY_DOMAINS = { "bunkr.ru", "bunkrr.ru", "bunkr.su", "bunkrr.su", "bunkr.la", "bunkr.is", "bunkr.to", } class BunkrAlbumExtractor(LolisafeAlbumExtractor): """Extractor for bunkr.sk albums""" category = "bunkr" root = "https://bunkr.sk" pattern = BASE_PATTERN + r"/a/([^/?#]+)" example = "https://bunkr.sk/a/ID" def __init__(self, match): LolisafeAlbumExtractor.__init__(self, match) domain = match.group(match.lastindex-1) if domain not in LEGACY_DOMAINS: self.root = "https://" + domain def fetch_album(self, album_id): # album metadata page = self.request(self.root + "/a/" + self.album_id).text info = text.split_html(text.extr( page, "").partition(">")[2]) count, _, size = info[1].split(None, 2) pos = page.index('class="grid-images') urls = list(text.extract_iter(page, '