From 88f1ef7c3cb2eb3ea639a5d061df0100771937ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 10 Jan 2025 23:30:13 +0100 Subject: [PATCH] [bunkr] fix metadata extraction (#6805) --- gallery_dl/extractor/bunkr.py | 18 +++++++++--------- test/results/bunkr.py | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gallery_dl/extractor/bunkr.py b/gallery_dl/extractor/bunkr.py index ef88498fd1..e1ee50d2cf 100644 --- a/gallery_dl/extractor/bunkr.py +++ b/gallery_dl/extractor/bunkr.py @@ -114,20 +114,20 @@ def request(self, url, **kwargs): def fetch_album(self, album_id): # album metadata - page = self.request(self.root + "/a/" + album_id).text - title, size = text.split_html(text.extr( - page, "").partition(">")[2]) - if "&" in title: - title = title.replace( - "<", "<").replace(">", ">").replace("&", "&") + page = self.request( + self.root + "/a/" + album_id, encoding="utf-8").text + title = text.unescape(text.unescape(text.extr( + page, 'property="og:title" content="', '"'))) # files items = list(text.extract_iter( page, '
")) + return self._extract_files(items), { "album_id" : album_id, "album_name" : title, - "album_size" : text.extr(size, "(", ")"), + "album_size" : text.extr( + page, '(', ')'), "count" : len(items), } @@ -140,8 +140,8 @@ def _extract_files(self, items): file = self._extract_file(url) info = text.split_html(item) - file["name"] = info[0] - file["size"] = info[2] + file["name"] = info[-3] + file["size"] = info[-2] file["date"] = text.parse_datetime( info[-1], "%H:%M:%S %d/%m/%Y") diff --git a/test/results/bunkr.py b/test/results/bunkr.py index fad558ec61..ed0bae6493 100644 --- a/test/results/bunkr.py +++ b/test/results/bunkr.py @@ -12,15 +12,15 @@ "#url" : "https://bunkr.sk/a/Lktg9Keq", "#category": ("lolisafe", "bunkr", "album"), "#class" : bunkr.BunkrAlbumExtractor, - "#urls" : "https://i-burger.bunkr.ru/test-%E3%83%86%E3%82%B9%E3%83%88-%22%26%3E-QjgneIQv.png?download=true", + "#urls" : "https://brg-bk.cdn.gigachad-cdn.ru/test-%E3%83%86%E3%82%B9%E3%83%88-%22%26%3E-QjgneIQv.png", "#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140", "album_id" : "Lktg9Keq", "album_name" : "test テスト \"&>", - "album_size" : "182 B", + "album_size" : "182 bytes", "count" : 1, "extension" : "png", - "file" : "https://i-burger.bunkr.ru/test-%E3%83%86%E3%82%B9%E3%83%88-%22%26%3E-QjgneIQv.png?download=true", + "file" : "https://brg-bk.cdn.gigachad-cdn.ru/test-%E3%83%86%E3%82%B9%E3%83%88-%22%26%3E-QjgneIQv.png", "filename" : "test-テスト-\"&>-QjgneIQv", "id" : "QjgneIQv", "name" : "test-テスト-\"&>", @@ -32,13 +32,13 @@ "#category": ("lolisafe", "bunkr", "album"), "#class" : bunkr.BunkrAlbumExtractor, "#urls" : ( - "https://i-milkshake.bunkr.ru/image-sZrQUeOx.jpg?download=true", + "https://mlk-bk.cdn.gigachad-cdn.ru/image-sZrQUeOx.jpg?n=image.jpg", ), - "#sha1_content": "caf7c3d3439d94e83b3c24ddaf5a3a48aa057519", + "#sha1_content": "55998743751dfe008d0e95605114fcbfa7dc4de8", "album_id" : "iXTTc1o2", "album_name" : "test2", - "album_size" : "534.6 KB", + "album_size" : "534.61 KB", "count" : 1, "filename" : r"image-sZrQUeOx", "id" : r"sZrQUeOx", @@ -182,12 +182,12 @@ "#url" : "https://bunkr.black/i/image-sZrQUeOx.jpg", "#category": ("lolisafe", "bunkr", "media"), "#class" : bunkr.BunkrMediaExtractor, - "#urls" : "https://i-milkshake.bunkr.ru/image-sZrQUeOx.jpg?download=true", - "#sha1_content": "caf7c3d3439d94e83b3c24ddaf5a3a48aa057519", + "#urls" : "https://mlk-bk.cdn.gigachad-cdn.ru/image-sZrQUeOx.jpg?n=image.jpg", + "#sha1_content": "55998743751dfe008d0e95605114fcbfa7dc4de8", "count" : 1, "extension": "jpg", - "file" : "https://i-milkshake.bunkr.ru/image-sZrQUeOx.jpg?download=true", + "file" : "https://mlk-bk.cdn.gigachad-cdn.ru/image-sZrQUeOx.jpg?n=image.jpg", "filename" : "image-sZrQUeOx", "id" : "sZrQUeOx", "name" : "image", @@ -205,12 +205,12 @@ "#url" : "https://bunkrrr.org/d/dJuETSzKLrUps", "#category": ("lolisafe", "bunkr", "media"), "#class" : bunkr.BunkrMediaExtractor, - "#urls" : "https://burger.bunkr.ru/file-r5fmwjdd.zip", + "#urls" : "https://brg-bk.cdn.gigachad-cdn.ru/file-r5fmwjdd.zip", "#sha1_content": "102ddd7894fe39b3843098fc51f972a0af938f45", "count" : 1, "extension": "zip", - "file" : "https://burger.bunkr.ru/file-r5fmwjdd.zip", + "file" : "https://brg-bk.cdn.gigachad-cdn.ru/file-r5fmwjdd.zip", "filename" : "file-r5fmwjdd", "id" : "r5fmwjdd", "name" : "file",