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:
parent
fd65f27ede
commit
7defb24e1e
@ -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"]
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user