2015-04-11 00:17:06 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-04-11 00:17:06 +02:00
|
|
|
# Copyright 2014, 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.
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-04-11 00:17:06 +02:00
|
|
|
"""Extract image-urls from https://danbooru.donmai.us/"""
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-04-11 00:17:06 +02:00
|
|
|
from .booru import JSONBooruExtractor
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-04-11 00:17:06 +02:00
|
|
|
info = {
|
|
|
|
"category": "danbooru",
|
|
|
|
"extractor": "DanbooruExtractor",
|
|
|
|
"directory": ["{category}", "{tags}"],
|
2015-11-06 16:48:33 +01:00
|
|
|
"filename": "{category}_{id}_{md5}.{extension}",
|
2015-04-11 00:17:06 +02:00
|
|
|
"pattern": [
|
|
|
|
r"(?:https?://)?(?:www\.)?danbooru.donmai.us/posts\?(?:utf8=%E2%9C%93&)?tags=([^&]+).*",
|
|
|
|
],
|
|
|
|
}
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-04-11 00:17:06 +02:00
|
|
|
class DanbooruExtractor(JSONBooruExtractor):
|
2014-12-30 21:34:55 +01:00
|
|
|
|
2015-10-05 15:35:48 +02:00
|
|
|
def __init__(self, match):
|
|
|
|
JSONBooruExtractor.__init__(self, match, info)
|
2015-04-11 16:22:15 +02:00
|
|
|
self.api_url = "https://danbooru.donmai.us/posts.json"
|