[behance] fix video extraction (#5965)

a lot slower than before since each video now requires an extra HTTP
request and 'sleep-request' is set to 2s-4s by default.

it now also requires ytdl.
This commit is contained in:
Mike Fährmann
2024-08-10 11:06:54 +02:00
parent 9783d95585
commit 6e7da6310c
2 changed files with 15 additions and 2 deletions

View File

@@ -164,6 +164,19 @@ class BehanceGalleryExtractor(BehanceExtractor):
append((size["url"], module))
elif mtype == "video":
try:
url = text.extr(module["embed"], 'src="', '"')
page = self.request(text.unescape(url)).text
url = text.extr(page, '<source src="', '"')
if text.ext_from_url(url) == "m3u8":
url = "ytdl:" + url
module["extension"] = "mp4"
append((url, module))
continue
except Exception as exc:
self.log.debug("%s: %s", exc.__class__.__name__, exc)
try:
renditions = module["videoData"]["renditions"]
except Exception: