mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
add extractor 'yandere'
This commit is contained in:
parent
07f23dc2fa
commit
762ad7426a
@ -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):
|
||||
|
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"
|
Loading…
Reference in New Issue
Block a user