1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

[pinterest] detect video/audio by block content (#6421)

story blocks from search/board results do not always contain a 'type'
This commit is contained in:
Mike Fährmann 2024-11-05 14:08:55 +01:00
parent a9a9f3a180
commit ce90566c56
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -117,12 +117,12 @@ class PinterestExtractor(Extractor):
else:
media = self._extract_image(page, block)
elif type == "story_pin_video_block":
elif type == "story_pin_video_block" or "video" in block:
video = block["video"]
media = self._extract_video(video)
media["media_id"] = video.get("id") or ""
elif type == "story_pin_music_block":
elif type == "story_pin_music_block" or "audio" in block:
media = block["audio"]
media["url"] = media["audio_url"]
media["media_id"] = media.get("id") or ""
@ -135,7 +135,10 @@ class PinterestExtractor(Extractor):
else:
self.log.warning("%s: Unsupported story block '%s'",
pin.get("id"), type)
continue
try:
media = self._extract_image(page, block)
except Exception:
continue
media["story_id"] = story_id
media["page_id"] = page_id