add extractor 'yandere'
This commit is contained in:
@@ -13,6 +13,7 @@ from .common import Message
|
|||||||
from .common import filename_from_url
|
from .common import filename_from_url
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import json
|
import json
|
||||||
|
import os.path
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +56,10 @@ class BooruExtractor(SequentialExtractor):
|
|||||||
def get_file_metadata(self, data):
|
def get_file_metadata(self, data):
|
||||||
"""Collect metadata for a downloadable file"""
|
"""Collect metadata for a downloadable file"""
|
||||||
data["category"] = self.info["category"]
|
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
|
return data
|
||||||
|
|
||||||
def get_file_url(self, data):
|
def get_file_url(self, data):
|
||||||
|
|||||||
27
gallery_dl/extractor/yandere.py
Normal file
27
gallery_dl/extractor/yandere.py
Normal file
@@ -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"
|
||||||
Reference in New Issue
Block a user