summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/hypnohub.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-07-02 04:33:45 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-07-02 04:33:45 -0400
commit195c45911e79c33cf0bb986721365fb06df5a153 (patch)
treeac0c9b6ef40bea7aa7ab0c5c3cb500eb510668fa /gallery_dl/extractor/hypnohub.py
Import Upstream version 1.8.7upstream/1.8.7
Diffstat (limited to 'gallery_dl/extractor/hypnohub.py')
-rw-r--r--gallery_dl/extractor/hypnohub.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/gallery_dl/extractor/hypnohub.py b/gallery_dl/extractor/hypnohub.py
new file mode 100644
index 0000000..bf2db96
--- /dev/null
+++ b/gallery_dl/extractor/hypnohub.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2019 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.
+
+"""Extractors for https://hypnohub.net/"""
+
+from . import booru
+
+
+class HypnohubExtractor(booru.MoebooruPageMixin, booru.BooruExtractor):
+ """Base class for hypnohub extractors"""
+ category = "hypnohub"
+ api_url = "https://hypnohub.net/post.json"
+ post_url = "https://hypnohub.net/post/show/{}"
+
+
+class HypnohubTagExtractor(booru.TagMixin, HypnohubExtractor):
+ """Extractor for images from hypnohub.net based on search-tags"""
+ pattern = (r"(?:https?://)?(?:www\.)?hypnohub\.net"
+ r"/post\?(?:[^&#]*&)*tags=(?P<tags>[^&#]+)")
+ test = ("https://hypnohub.net/post?tags=gonoike_biwa", {
+ "url": "6bebc4318489ee37e0c3b814352acd6783ba95d6",
+ })
+
+
+class HypnohubPoolExtractor(booru.PoolMixin, HypnohubExtractor):
+ """Extractor for image-pools from hypnohub.net"""
+ pattern = r"(?:https?://)?(?:www\.)?hypnohub\.net/pool/show/(?P<pool>\d+)"
+ test = ("https://hypnohub.net/pool/show/61", {
+ "url": "fd74991c8729e77acd3c35eb6ddc4128ff445adf",
+ })
+
+
+class HypnohubPostExtractor(booru.PostMixin, HypnohubExtractor):
+ """Extractor for single images from hypnohub.net"""
+ pattern = r"(?:https?://)?(?:www\.)?hypnohub\.net/post/show/(?P<post>\d+)"
+ test = ("https://hypnohub.net/post/show/73964", {
+ "content": "02d5f5a8396b621a6efc04c5f8ef1b7225dfc6ee",
+ "options": (("tags", True),),
+ "keyword": {
+ "tags_artist": "gonoike_biwa icontrol_(manipper)",
+ "tags_character": "komaru_naegi",
+ "tags_copyright": "dangan_ronpa dangan_ronpa_another_episode",
+ "tags_general": str,
+ },
+ })
+
+
+class HypnohubPopularExtractor(booru.MoebooruPopularMixin, HypnohubExtractor):
+ """Extractor for popular images from hypnohub.net"""
+ pattern = (r"(?:https?://)?(?:www\.)?hypnohub\.net"
+ r"/post/popular_(?P<scale>by_(?:day|week|month)|recent)"
+ r"(?:\?(?P<query>[^#]*))?")
+ test = (
+ ("https://hypnohub.net/post/popular_by_month?month=6&year=2014", {
+ "count": 20,
+ }),
+ ("https://hypnohub.net/post/popular_recent"),
+ )
+
+ def __init__(self, match):
+ super().__init__(match)
+ self.api_url = "https://hypnohub.net/post/popular_{scale}.json".format(
+ scale=self.scale)