# -*- coding: utf-8 -*- # Copyright 2024 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://archiveofourown.org/""" from .common import Extractor, Message from .. import text, util BASE_PATTERN = (r"(?:https?://)?(?:www\.)?" r"a(?:rchiveofourown|o3)\.(?:org|com|net)") class Ao3Extractor(Extractor): """Base class for ao3 extractors""" category = "ao3" root = "https://archiveofourown.org" categorytransfer = True request_interval = (0.5, 1.5) def items(self): base = self.root + "/works/" data = {"_extractor": Ao3WorkExtractor} for work_id in self.works(): yield Message.Queue, base + work_id, data def works(self): return self._pagination(self.groups[0]) def _pagination(self, path, needle='