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

[reddit] provide video previews if available (#4322)

This commit is contained in:
Mike Fährmann 2023-08-28 18:05:31 +02:00
parent fd65f27ede
commit 7defb24e1e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 12 additions and 0 deletions

View File

@ -173,6 +173,16 @@ class RedditExtractor(Extractor):
return submission["url"]
def _previews(self, post):
try:
if "reddit_video_preview" in post["preview"]:
video = post["preview"]["reddit_video_preview"]
if "dash_url" in video:
yield "ytdl:" + video["dash_url"]
if "hls_url" in video:
yield "ytdl:" + video["hls_url"]
except Exception as exc:
self.log.debug("%s: %s", exc.__class__.__name__, exc)
try:
for image in post["preview"]["images"]:
yield image["source"]["url"]

View File

@ -404,6 +404,8 @@ class DownloadJob(Job):
pass
else:
text.nameext_from_url(url, kwdict)
if url.startswith("ytdl:"):
kwdict["extension"] = ""
self.handle_url(url, kwdict)
break
except exception.RestartExtraction: