From 88a386977e009cda51bfe8a66bced3686a13bb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 26 Aug 2017 23:08:52 +0200 Subject: [PATCH] [booru] add "popular" extractors for more sites - konachan.com - behoimi.org - e621.net --- gallery_dl/extractor/3dbooru.py | 15 +++++++++++++++ gallery_dl/extractor/e621.py | 14 ++++++++++++++ gallery_dl/extractor/konachan.py | 13 +++++++++++++ 3 files changed, 42 insertions(+) diff --git a/gallery_dl/extractor/3dbooru.py b/gallery_dl/extractor/3dbooru.py index 67f10bc8..33fd37d1 100644 --- a/gallery_dl/extractor/3dbooru.py +++ b/gallery_dl/extractor/3dbooru.py @@ -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" diff --git a/gallery_dl/extractor/e621.py b/gallery_dl/extractor/e621.py index ef0e5622..4642b806 100644 --- a/gallery_dl/extractor/e621.py +++ b/gallery_dl/extractor/e621.py @@ -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" diff --git a/gallery_dl/extractor/konachan.py b/gallery_dl/extractor/konachan.py index 7859be2a..506664cc 100644 --- a/gallery_dl/extractor/konachan.py +++ b/gallery_dl/extractor/konachan.py @@ -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"