mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +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:
parent
a9a9f3a180
commit
ce90566c56
@ -117,12 +117,12 @@ class PinterestExtractor(Extractor):
|
|||||||
else:
|
else:
|
||||||
media = self._extract_image(page, block)
|
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"]
|
video = block["video"]
|
||||||
media = self._extract_video(video)
|
media = self._extract_video(video)
|
||||||
media["media_id"] = video.get("id") or ""
|
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 = block["audio"]
|
||||||
media["url"] = media["audio_url"]
|
media["url"] = media["audio_url"]
|
||||||
media["media_id"] = media.get("id") or ""
|
media["media_id"] = media.get("id") or ""
|
||||||
@ -135,7 +135,10 @@ class PinterestExtractor(Extractor):
|
|||||||
else:
|
else:
|
||||||
self.log.warning("%s: Unsupported story block '%s'",
|
self.log.warning("%s: Unsupported story block '%s'",
|
||||||
pin.get("id"), type)
|
pin.get("id"), type)
|
||||||
continue
|
try:
|
||||||
|
media = self._extract_image(page, block)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
|
||||||
media["story_id"] = story_id
|
media["story_id"] = story_id
|
||||||
media["page_id"] = page_id
|
media["page_id"] = page_id
|
||||||
|
Loading…
Reference in New Issue
Block a user