diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 05e75405..2fad3f2f 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -372,19 +372,24 @@ class ImgclickImageExtractor(ImagehostImageExtractor): class FappicImageExtractor(ImagehostImageExtractor): """Extractor for single images from fappic.com""" category = "fappic" - pattern = r"(?:https?://)?((?:www\.)?fappic\.com/(\w+)/[^/?#]+)" - example = "https://fappic.com/abc123/NAME.EXT" + pattern = (r"(?:https?://)?(?:www\.|img\d+\.)?fappic\.com" + r"/(?:i/\d+/())?(\w{10,})(?:/|\.)\w+") + example = "https://fappic.com/abcde12345/NAME.EXT" + + def __init__(self, match): + Extractor.__init__(self, match) + + thumb, token = self.groups + if thumb is not None and token.endswith("_t"): + self.token = token = token[:-2] + else: + self.token = token + self.page_url = f"https://fappic.com/{token}/pic.jpg" def get_info(self, page): url , pos = text.extract(page, '