summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/gelbooru.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-06-05 20:55:36 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2021-06-05 20:55:36 -0400
commit8a644b7a06c504263a478d3681eed10b4161b5be (patch)
treeb3d668588e5c0be8c75467e50499f73ff9ec7c05 /gallery_dl/extractor/gelbooru.py
parente7eb1f9779f2e223575ab23a6bc1abf2222e7d27 (diff)
New upstream version 1.17.5.upstream/1.17.5
Diffstat (limited to 'gallery_dl/extractor/gelbooru.py')
-rw-r--r--gallery_dl/extractor/gelbooru.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py
index 863cead..df45d0d 100644
--- a/gallery_dl/extractor/gelbooru.py
+++ b/gallery_dl/extractor/gelbooru.py
@@ -8,8 +8,10 @@
"""Extractors for https://gelbooru.com/"""
+from .common import Extractor, Message
from . import gelbooru_v02
from .. import text, exception
+import binascii
class GelbooruBase():
@@ -131,3 +133,23 @@ class GelbooruPostExtractor(GelbooruBase,
}
}),
)
+
+
+class GelbooruRedirectExtractor(GelbooruBase, Extractor):
+ subcategory = "redirect"
+ pattern = (r"(?:https?://)?(?:www\.)?gelbooru\.com"
+ r"/redirect\.php\?s=([^&#]+)")
+ test = (("https://gelbooru.com/redirect.php?s=Ly9nZWxib29ydS5jb20vaW5kZXgu"
+ "cGhwP3BhZ2U9cG9zdCZzPXZpZXcmaWQ9MTgzMDA0Ng=="), {
+ "pattern": r"https://gelbooru.com/index.php"
+ r"\?page=post&s=view&id=1830046"
+ })
+
+ def __init__(self, match):
+ Extractor.__init__(self, match)
+ self.redirect_url = text.ensure_http_scheme(
+ binascii.a2b_base64(match.group(1)).decode())
+
+ def items(self):
+ data = {"_extractor": GelbooruPostExtractor}
+ yield Message.Queue, self.redirect_url, data