[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:
@@ -164,6 +164,19 @@ class BehanceGalleryExtractor(BehanceExtractor):
|
|||||||
append((size["url"], module))
|
append((size["url"], module))
|
||||||
|
|
||||||
elif mtype == "video":
|
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:
|
try:
|
||||||
renditions = module["videoData"]["renditions"]
|
renditions = module["videoData"]["renditions"]
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ __tests__ = (
|
|||||||
"Place Studio",
|
"Place Studio",
|
||||||
"Julio César Velazquez",
|
"Julio César Velazquez",
|
||||||
],
|
],
|
||||||
"fields": [
|
"?fields": [
|
||||||
"Animation",
|
"Animation",
|
||||||
"Character Design",
|
"Character Design",
|
||||||
"Directing",
|
"Directing",
|
||||||
@@ -59,7 +59,7 @@ __tests__ = (
|
|||||||
"#comment" : "'video' modules (#1282)",
|
"#comment" : "'video' modules (#1282)",
|
||||||
"#category": ("", "behance", "gallery"),
|
"#category": ("", "behance", "gallery"),
|
||||||
"#class" : behance.BehanceGalleryExtractor,
|
"#class" : behance.BehanceGalleryExtractor,
|
||||||
"#pattern" : r"https://cdn-prod-ccv\.adobe\.com/\w+/rend/\w+_720\.mp4\?",
|
"#pattern" : r"ytdl:https://cdn-prod-ccv\.adobe\.com/\w+/rend/master\.m3u8\?",
|
||||||
"#count" : 3,
|
"#count" : 3,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user