[bunkr] fix file downloads (#6037)

This commit is contained in:
Mike Fährmann
2024-08-17 11:01:42 +02:00
parent ef4c1b4fc5
commit 8ea75202ed
2 changed files with 18 additions and 13 deletions

View File

@@ -70,11 +70,16 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
def _extract_file(self, url):
page = self.request(url).text
return (
text.extr(page, '<source src="', '"') or
text.extr(page, '<img src="', '"') or
text.rextract(page, ' href="', '"', page.rindex("Download"))[0]
)
url = (text.extr(page, '<source src="', '"') or
text.extr(page, '<img src="', '"'))
if not url:
url_download = text.rextract(
page, ' href="', '"', page.rindex("Download"))[0]
page = self.request(text.unescape(url_download)).text
url = text.unescape(text.rextract(page, ' href="', '"')[0])
return url
def _validate(self, response):
if response.history and response.url.endswith("/maintenance-vid.mp4"):

View File

@@ -175,18 +175,18 @@ __tests__ = (
},
{
"#url" : "https://bunkr.red/v/MY5aa4cLO7jN5",
"#url" : "https://bunkrrr.org/d/sample-1-F3aGP907.zip",
"#category": ("lolisafe", "bunkr", "media"),
"#class" : bunkr.BunkrMediaExtractor,
"#urls" : "https://burger.bunkr.ru/video-gLn1hgpw.mp4",
"#sha1_content": "f7a2ab24766a15ceffff1b07bada432b13ff8e5b",
"#urls" : "https://burger.bunkr.ru/sample-1-F3aGP907.zip",
"#sha1_content": "d342c3982efc4b69dc18b2d4801fd08290e1ff12",
"count" : 1,
"extension": "mp4",
"file" : "https://burger.bunkr.ru/video-gLn1hgpw.mp4",
"filename" : "video-gLn1hgpw",
"id" : "gLn1hgpw",
"name" : "video",
"extension": "zip",
"file" : "https://burger.bunkr.ru/sample-1-F3aGP907.zip",
"filename" : "sample-1-F3aGP907",
"id" : "F3aGP907",
"name" : "sample-1",
},
)