Skip to content

Commit

Permalink
[behance] fix video extraction (#5965)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikf committed Aug 10, 2024
1 parent 9783d95 commit 6e7da63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions gallery_dl/extractor/behance.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ def get_images(self, data):
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:
Expand Down
4 changes: 2 additions & 2 deletions test/results/behance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"Place Studio",
"Julio César Velazquez",
],
"fields": [
"?fields": [
"Animation",
"Character Design",
"Directing",
Expand Down Expand Up @@ -59,7 +59,7 @@
"#comment" : "'video' modules (#1282)",
"#category": ("", "behance", "gallery"),
"#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,
},

Expand Down

0 comments on commit 6e7da63

Please sign in to comment.