From c05dbd15b5d78f6e30867ede03daf6ecf2351158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 6 Nov 2015 14:14:29 +0100 Subject: [PATCH] [gelbooru] support authentication to enable api access --- gallery-dl.conf | 7 ++++++- gallery_dl/extractor/gelbooru.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gallery-dl.conf b/gallery-dl.conf index 3cb8d403..3395dd52 100644 --- a/gallery-dl.conf +++ b/gallery-dl.conf @@ -33,7 +33,12 @@ "gelbooru": { "pattern": ["g(?:elbooru)?[.:-_](\\w.+)"], - "filename": "{category}_{id:>07}_{md5}.{extension}" + "filename": "{category}_{id:>07}_{md5}.{extension}", + "cookies": + { + "user_id": null, + "pass_hash": null, + } } } } diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py index 87244904..e5c4f8e7 100644 --- a/gallery_dl/extractor/gelbooru.py +++ b/gallery_dl/extractor/gelbooru.py @@ -9,6 +9,7 @@ """Extract image-urls from http://gelbooru.com/""" from .booru import XMLBooruExtractor +from .. import config info = { "category": "gelbooru", @@ -26,6 +27,9 @@ class GelbooruExtractor(XMLBooruExtractor): XMLBooruExtractor.__init__(self, match, info) self.api_url = "http://gelbooru.com/" self.params = {"page":"dapi", "s":"post", "q":"index", "tags":self.tags} + self.session.cookies.update( + config.get(("extractor", info["category"], "cookies")) + ) def update_page(self, reset=False): if reset is False: