2015-04-15 17:35:30 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-08-26 21:47:45 +02:00
|
|
|
# Copyright 2015-2017 Mike Fährmann
|
2015-04-15 17:35:30 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extract images from https://yande.re/"""
|
2015-04-15 17:35:30 +02:00
|
|
|
|
2015-11-21 00:55:40 +01:00
|
|
|
from . import booru
|
2015-04-15 17:35:30 +02:00
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2015-11-21 00:55:40 +01:00
|
|
|
class YandereExtractor(booru.JSONBooruExtractor):
|
|
|
|
"""Base class for yandere extractors"""
|
|
|
|
category = "yandere"
|
|
|
|
api_url = "https://yande.re/post.json"
|
2015-04-15 17:35:30 +02:00
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2015-11-21 00:55:40 +01:00
|
|
|
class YandereTagExtractor(YandereExtractor, booru.BooruTagExtractor):
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extractor for images from yande.re based on search-tags"""
|
2015-11-21 00:55:40 +01:00
|
|
|
pattern = [r"(?:https?://)?(?:www\.)?yande\.re/post\?tags=([^&]+)"]
|
2017-10-23 17:00:53 +02:00
|
|
|
test = [("https://yande.re/post?tags=ouzoku+armor", {
|
2015-12-22 03:10:52 +01:00
|
|
|
"content": "59201811c728096b2d95ce6896fd0009235fe683",
|
|
|
|
})]
|
2015-04-15 17:35:30 +02:00
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2015-11-21 00:55:40 +01:00
|
|
|
class YanderePoolExtractor(YandereExtractor, booru.BooruPoolExtractor):
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extractor for image-pools from yande.re"""
|
2017-08-24 21:24:51 +02:00
|
|
|
pattern = [r"(?:https?://)?(?:www\.)?yande\.re/pool/show/(\d+)"]
|
2015-12-22 03:10:52 +01:00
|
|
|
test = [("https://yande.re/pool/show/318", {
|
|
|
|
"content": "2a35b9d6edecce11cc2918c6dce4de2198342b68",
|
2015-12-14 03:00:58 +01:00
|
|
|
})]
|
2015-11-21 00:55:40 +01:00
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2015-11-21 00:55:40 +01:00
|
|
|
class YanderePostExtractor(YandereExtractor, booru.BooruPostExtractor):
|
2016-09-12 10:20:57 +02:00
|
|
|
"""Extractor for single images from yande.re"""
|
2017-08-24 21:24:51 +02:00
|
|
|
pattern = [r"(?:https?://)?(?:www\.)?yande\.re/post/show/(\d+)"]
|
2015-12-22 03:10:52 +01:00
|
|
|
test = [("https://yande.re/post/show/51824", {
|
|
|
|
"content": "59201811c728096b2d95ce6896fd0009235fe683",
|
2015-12-14 03:00:58 +01:00
|
|
|
})]
|
2017-08-24 21:24:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
class YanderePopularExtractor(YandereExtractor, booru.BooruPopularExtractor):
|
|
|
|
"""Extractor for popular images from yande.re"""
|
|
|
|
pattern = [r"(?:https?://)?(?:www\.)?yande\.re/post/popular_"
|
|
|
|
r"(by_(?:day|week|month)|recent)(?:\?([^#]*))?"]
|
|
|
|
test = [
|
2017-08-31 15:09:18 +02:00
|
|
|
("https://yande.re/post/popular_by_month?month=6&year=2014", {
|
2017-08-25 22:01:14 +02:00
|
|
|
"count": 40,
|
2017-08-24 21:24:51 +02:00
|
|
|
}),
|
|
|
|
("https://yande.re/post/popular_recent", None),
|
|
|
|
]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def api_url(self):
|
|
|
|
return "https://yande.re/post/popular_" + self.scale + ".json"
|