# -*- coding: utf-8 -*- # Copyright 2025 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://imgpile.com/""" from .common import Extractor, Message from .. import text BASE_PATTERN = r"(?:https?://)?(?:www\.)?imgpile\.com" class ImgpileExtractor(Extractor): """Base class for imgpile extractors""" category = "imgpile" root = "https://imgpile.com" directory_fmt = ("{category}", "{post[author]}", "{post[title]} ({post[id_slug]})") archive_fmt = "{post[id_slug]}_{id}" class ImgpilePostExtractor(ImgpileExtractor): subcategory = "post" pattern = BASE_PATTERN + r"/p/(\w+)" example = "https://imgpile.com/p/AbCdEfG" def items(self): post_id = self.groups[0] url = f"{self.root}/p/{post_id}" page = self.request(url).text extr = text.extract_from(page) post = { "id_slug": post_id, "title" : text.unescape(extr("