mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
10.74k stars 883 forks source link

[Site Support Request] Bunkr (new domain) #3391

Closed github-user283 closed 1 year ago

github-user283 commented 1 year ago

Looks like bunkr changed domains from .is to .ru, downloads aren't processing anymore.

I tried to make a custom downloader but I figured this isn't implemented for bunkr.

{
    "extractor": {
        "bunkr": {
            "bunkrru": {"root": "https://bunkr.ru"}
        }
    }
}

Here's a test URL I found in a previous thread, but with the new domain.

https://bunkr.ru/a/iXTTc1o2

Super rusty right now, but I might try to play with the bunkr extractor and publish a pr if I get it working. Otherwise, any help is appreciated.

enduser420 commented 1 year ago

this works

diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py
index 7e9a4220..25189ae6 100644
--- a/gallery_dl/extractor/bunkr.py
+++ b/gallery_dl/extractor/bunkr.py
@@ -16,8 +16,7 @@ import json
 class BunkrAlbumExtractor(LolisafeAlbumExtractor):
     """Extractor for bunkr.is albums"""
     category = "bunkr"
-    root = "https://bunkr.is"
-    pattern = r"(?:https?://)?(?:app\.)?bunkr\.(?:is|to)/a/([^/?#]+)"
+    pattern = r"(?:https?://)?(?:app\.)?bunkr\.(?:is|to|ru)/a/([^/?#]+)"
     test = (
         ("https://bunkr.is/a/Lktg9Keq", {
             "pattern": r"https://cdn\.bunkr\.is/test-テスト-\"&>-QjgneIQv\.png",
@@ -78,7 +77,9 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
             self.root = self.root.replace("bunkr", "app.bunkr", 1)
             return self._fetch_album_api(album_id)

-        headers = {"Referer": "https://stream.bunkr.is/"}
+        headers = {
+            "Referer": "https://stream." + self.root.partition("://")[2] + "/",
+        }

         for file in files:
             name = file["name"]
mikf commented 1 year ago

As a workaround, you can force a specific domain with the domain option: gallery-dl -o domain=bunkr.ru https://bunkr.is/a/iXTTc1o2

      "bunkr": {
          "bunkrru": {"root": "https://bunkr.ru"}
      }

This only works for the basecategory value, which is lolisafe in this case, and it still wouldn't work as expected since bunkr needs special treatment. The generic lolisafe extractor wouldn't cut it here.