From 00f3b48eb830f642485f358c0b071fa2ba5a7a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 20 Apr 2025 00:09:28 +0200 Subject: [PATCH] [gelbooru] don't hardcode image server domains (#7392) --- gallery_dl/extractor/gelbooru.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py index eb077396..f24b6960 100644 --- a/gallery_dl/extractor/gelbooru.py +++ b/gallery_dl/extractor/gelbooru.py @@ -107,22 +107,16 @@ class GelbooruBase(): return params["pid"] += self.per_page - @staticmethod - def _file_url(post): + def _file_url(self, post): url = post["file_url"] if url.endswith((".webm", ".mp4")): + post["_fallback"] = (url,) md5 = post["md5"] + root = text.root_from_url(post["preview_url"]) path = "/images/{}/{}/{}.webm".format(md5[0:2], md5[2:4], md5) - post["_fallback"] = GelbooruBase._video_fallback(path) - url = "https://img4.gelbooru.com" + path + url = root + path return url - @staticmethod - def _video_fallback(path): - yield "https://img3.gelbooru.com" + path - yield "https://img2.gelbooru.com" + path - yield "https://img1.gelbooru.com" + path - def _notes(self, post, page): notes_data = text.extr(page, '
') if not notes_data: