[path] implement dynamic length directories (#1350)

append directory segments for each item of a list (or general non-string
iterable), which can be returned with the 'I' specifier
This commit is contained in:
Mike Fährmann
2025-12-18 09:53:26 +01:00
parent 73db1846e1
commit c3d8602418
3 changed files with 16 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ BASE_PATTERN = r"(?:https?://)?(?:www\.)?aryion\.com/g4"
class AryionExtractor(Extractor):
"""Base class for aryion extractors"""
category = "aryion"
directory_fmt = ("{category}", "{user!l}", "{path:J - }")
directory_fmt = ("{category}", "{user!l}", "{path:I}")
filename_fmt = "{id} {title}.{extension}"
archive_fmt = "{id}"
cookies_domain = ".aryion.com"

View File

@@ -18,8 +18,7 @@ class BbcGalleryExtractor(GalleryExtractor):
"""Extractor for a programme gallery on bbc.co.uk"""
category = "bbc"
root = "https://www.bbc.co.uk"
directory_fmt = ("{category}", "{path[0]}", "{path[1]}", "{path[2]}",
"{path[3:]:J - /}")
directory_fmt = ("{category}", "{path:I}")
filename_fmt = "{num:>02}.{extension}"
archive_fmt = "{programme}_{num}"
pattern = rf"{BASE_PATTERN}[^/?#]+(?!/galleries)(?:/[^/?#]+)?)$"