[reddit] provide video previews if available (#4322)
This commit is contained in:
@@ -173,6 +173,16 @@ class RedditExtractor(Extractor):
|
|||||||
return submission["url"]
|
return submission["url"]
|
||||||
|
|
||||||
def _previews(self, post):
|
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:
|
try:
|
||||||
for image in post["preview"]["images"]:
|
for image in post["preview"]["images"]:
|
||||||
yield image["source"]["url"]
|
yield image["source"]["url"]
|
||||||
|
|||||||
@@ -404,6 +404,8 @@ class DownloadJob(Job):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
text.nameext_from_url(url, kwdict)
|
text.nameext_from_url(url, kwdict)
|
||||||
|
if url.startswith("ytdl:"):
|
||||||
|
kwdict["extension"] = ""
|
||||||
self.handle_url(url, kwdict)
|
self.handle_url(url, kwdict)
|
||||||
break
|
break
|
||||||
except exception.RestartExtraction:
|
except exception.RestartExtraction:
|
||||||
|
|||||||
Reference in New Issue
Block a user