diff --git a/gallery_dl/extractor/booru.py b/gallery_dl/extractor/booru.py index 1684531a..ce6b0326 100644 --- a/gallery_dl/extractor/booru.py +++ b/gallery_dl/extractor/booru.py @@ -13,6 +13,7 @@ from .common import Message from .common import filename_from_url import xml.etree.ElementTree as ET import json +import os.path import urllib.parse @@ -55,7 +56,10 @@ class BooruExtractor(SequentialExtractor): def get_file_metadata(self, data): """Collect metadata for a downloadable file""" data["category"] = self.info["category"] - data["name"] = filename_from_url(self.get_file_url(data)) + data["name"] = urllib.parse.unquote( + filename_from_url(self.get_file_url(data)) + ) + data["extension"] = os.path.splitext(data["name"])[1][1:] return data def get_file_url(self, data): diff --git a/gallery_dl/extractor/yandere.py b/gallery_dl/extractor/yandere.py new file mode 100644 index 00000000..2e574b11 --- /dev/null +++ b/gallery_dl/extractor/yandere.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Copyright 2015 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. + +"""Extract image-urls from https://yande.re/""" + +from .booru import JSONBooruExtractor + +info = { + "category": "yandere", + "extractor": "YandereExtractor", + "directory": ["{category}", "{tags}"], + "filename": "{category}_{md5}.{extension}", + "pattern": [ + r"(?:https?://)?(?:www\.)?yande\.re/post\?tags=([^&]+).*", + ], +} + +class YandereExtractor(JSONBooruExtractor): + + def __init__(self, match, config): + JSONBooruExtractor.__init__(self, match, config, info) + self.api_url = "https://yande.re/post.json"