From bbc4190017124653f7efbd84e00e9e1a66ff4435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 19 Feb 2022 03:55:14 +0100 Subject: [PATCH] [bunkr] fix .mp4 downloads (#2239) again ... --- gallery_dl/extractor/lolisafe.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/gallery_dl/extractor/lolisafe.py b/gallery_dl/extractor/lolisafe.py index c63fa51c..43377bd1 100644 --- a/gallery_dl/extractor/lolisafe.py +++ b/gallery_dl/extractor/lolisafe.py @@ -44,7 +44,7 @@ class LolisafelbumExtractor(LolisafeExtractor): }), # mp4 (#2239) ("https://bunkr.is/a/ptRHaCn2", { - "pattern": r"https://cdn\.bunkr\.is/_-RnHoW69L\.mp4", + "pattern": r"https://media-files\.bunkr\.is/_-RnHoW69L\.mp4", "content": "80e61d1dbc5896ae7ef9a28734c747b28b320471", }), ("https://bunkr.to/a/Lktg9Keq"), @@ -73,9 +73,8 @@ class LolisafelbumExtractor(LolisafeExtractor): data["name"], sep, data["id"] = data["filename"].rpartition("-") if data["extension"] == "mp4": - data["_http_validate"] = self._check_rewrite - else: - data["_http_validate"] = None + url = url.replace( + "//cdn.bunkr.is/", "//media-files.bunkr.is/", 1) yield Message.Url, url, data def fetch_album(self, album_id): @@ -87,13 +86,3 @@ class LolisafelbumExtractor(LolisafeExtractor): "album_name": text.unescape(data["title"]), "count" : data["count"], } - - @staticmethod - def _check_rewrite(response): - if response.history and response.headers.get( - "Content-Type").startswith("text/html"): - # consume content to reuse connection - response.content - # rewrite to download URL - return response.url.replace("/v/", "/d/", 1) - return True