[booru] add "popular" extractors for more sites

- konachan.com
- behoimi.org
- e621.net
This commit is contained in:
Mike Fährmann
2017-08-26 23:08:52 +02:00
parent 07214f4007
commit 88a386977e
3 changed files with 42 additions and 0 deletions

View File

@@ -50,3 +50,18 @@ class ThreedeebooruPostExtractor(ThreedeebooruExtractor,
"url": "ce874ea26f01d6c94795f3cc3aaaaa9bc325f2f6",
"content": "26549d55b82aa9a6c1686b96af8bfcfa50805cd4",
})]
class ThreedeebooruPopularExtractor(ThreedeebooruExtractor,
booru.BooruPopularExtractor):
"""Extractor for popular images from behoimi.org"""
pattern = [r"(?:https?://)?(?:www\.)?behoimi\.org/post/popular_"
r"(by_(?:day|week|month)|recent)(?:\?([^#]*))?"]
test = [("http://behoimi.org/post/popular_by_month?month=6&year=2017", {
"url": "d2f8b04e54b12b8daaa4ba5fbea84d7dabe8a5df",
"count": 20,
})]
@property
def api_url(self):
return "http://behoimi.org/post/popular_" + self.scale + ".json"

View File

@@ -45,3 +45,17 @@ class E621PostExtractor(E621Extractor, booru.BooruPostExtractor):
"url": "f7f78b44c9b88f8f09caac080adc8d6d9fdaa529",
"content": "66f46e96a893fba8e694c4e049b23c2acc9af462",
})]
class E621PopularExtractor(E621Extractor, booru.BooruPopularExtractor):
"""Extractor for popular images from 621.net"""
pattern = [r"(?:https?://)?(?:www\.)?e621\.net/post/popular_by_"
r"(day|week|month)(?:\?([^#]*))?"]
test = [("https://e621.net/post/popular_by_month?month=6&year=2017", {
"url": "e09aba8e7f2026e7925e7f7b74c1ea9da2a1682d",
"count": 32,
})]
@property
def api_url(self):
return "https://e621.net/post/popular_by_" + self.scale + ".json"

View File

@@ -39,3 +39,16 @@ class KonachanPostExtractor(KonachanExtractor, booru.BooruPostExtractor):
test = [("http://konachan.com/post/show/205189", {
"content": "674e75a753df82f5ad80803f575818b8e46e4b65",
})]
class KonachanPopularExtractor(KonachanExtractor, booru.BooruPopularExtractor):
"""Extractor for popular images from konachan.com"""
pattern = [r"(?:https?://)?(?:www\.)?konachan\.com/post/popular_"
r"(by_(?:day|week|month)|recent)(?:\?([^#]*))?"]
test = [("https://konachan.com/post/popular_by_month?month=11&year=2016", {
"count": 20,
})]
@property
def api_url(self):
return "https://konachan.com/post/popular_" + self.scale + ".json"