From a782b009b80523103a8883684e589f252e19091e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 9 Oct 2019 17:30:30 +0200 Subject: [PATCH] [yaplog] match blog names with '-' (#443) --- gallery_dl/extractor/yaplog.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gallery_dl/extractor/yaplog.py b/gallery_dl/extractor/yaplog.py index b3c55013..c047b651 100644 --- a/gallery_dl/extractor/yaplog.py +++ b/gallery_dl/extractor/yaplog.py @@ -12,6 +12,9 @@ from .common import Extractor, Message, AsynchronousMixin from .. import text, util +BASE_PATTERN = r"(?:https?://)?(?:www\.)?yaplog\.jp/([\w-]+)" + + class YaplogExtractor(AsynchronousMixin, Extractor): """Base class for yaplog extractors""" category = "yaplog" @@ -76,7 +79,7 @@ class YaplogExtractor(AsynchronousMixin, Extractor): class YaplogBlogExtractor(YaplogExtractor): """Extractor for a user's blog on yaplog.jp""" subcategory = "blog" - pattern = r"(?:https?://)?(?:www\.)?yaplog\.jp/(\w+)/?(?:$|[?&#])" + pattern = BASE_PATTERN + r"/?(?:$|[?&#])" test = ("https://yaplog.jp/omitakashi3", { "pattern": r"https://img.yaplog.jp/img/18/pc/o/m/i/omitakashi3/0/", "count": ">= 2", @@ -92,12 +95,15 @@ class YaplogBlogExtractor(YaplogExtractor): class YaplogPostExtractor(YaplogExtractor): """Extractor for images from a blog post on yaplog.jp""" subcategory = "post" - pattern = (r"(?:https?://)?(?:www\.)?yaplog\.jp" - r"/(\w+)/(?:archive|image)/(\d+)") - test = ("https://yaplog.jp/imamiami0726/image/1299", { - "url": "896cae20fa718735a57e723c48544e830ff31345", - "keyword": "f8d8781e61c4c38238a7622d6df6c905f864e5d3", - }) + pattern = BASE_PATTERN + r"/(?:archive|image)/(\d+)" + test = ( + ("https://yaplog.jp/imamiami0726/image/1299", { + "url": "896cae20fa718735a57e723c48544e830ff31345", + "keyword": "f8d8781e61c4c38238a7622d6df6c905f864e5d3", + }), + # blog names with '-' (#443) + ("https://yaplog.jp/a-pierrot-o/image/3946/22779"), + ) def __init__(self, match): YaplogExtractor.__init__(self, match)