1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-24 11:42:33 +01:00

[danbooru] move all initialization code into '_init()'

This commit is contained in:
Mike Fährmann 2024-11-17 16:15:53 +01:00
parent 55afd712d6
commit 9184a5643a
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -23,9 +23,19 @@ class DanbooruExtractor(BaseExtractor):
request_interval = (0.5, 1.5)
def _init(self):
self.session.headers["User-Agent"] = util.USERAGENT
self.ugoira = self.config("ugoira", False)
self.external = self.config("external", False)
self.includes = False
includes = self.config("metadata")
if includes:
if isinstance(includes, (list, tuple)):
includes = ",".join(includes)
elif not isinstance(includes, str):
includes = "artist_commentary,children,notes,parent,uploader"
self.includes = includes + ",id"
else:
self.includes = False
threshold = self.config("threshold")
if isinstance(threshold, int):
@ -46,16 +56,6 @@ class DanbooruExtractor(BaseExtractor):
return pages * self.per_page
def items(self):
self.session.headers["User-Agent"] = util.USERAGENT
includes = self.config("metadata")
if includes:
if isinstance(includes, (list, tuple)):
includes = ",".join(includes)
elif not isinstance(includes, str):
includes = "artist_commentary,children,notes,parent,uploader"
self.includes = includes + ",id"
data = self.metadata()
for post in self.posts():