diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index 4979442d..83f01b64 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -215,7 +215,10 @@ class RedditExtractor(Extractor): if src := data.get("s"): if url := src.get("u") or src.get("gif") or src.get("mp4"): - yield url.partition("?")[0].replace("/preview.", "/i.", 1) + if "//external" not in url: + url = url.partition("?")[0].replace( + "/preview.", "/i.", 1) + yield url else: self.log.error( "embed %s: unable to fetch download URL for item %s", diff --git a/test/results/reddit.py b/test/results/reddit.py index ca1dc1a0..329a0e59 100644 --- a/test/results/reddit.py +++ b/test/results/reddit.py @@ -303,6 +303,16 @@ __tests__ = ( "#results" : "ytdl:https://v.redd.it/link/1n260wh/asset/8q50b220tplf1/DASHPlaylist.mpd?a=1759085227%2CYTU2NGJjNTlmNjBlOGE2NWUwYWI0MjRjZDYzZjllZjk4Nzc3Y2Y4Nzc1NDMzOTBkYTNkOWFjOGMzZjUzZDAzMQ%3D%3D&v=1&f=sd", }, +{ + "#url" : "https://www.reddit.com/r/vi/comments/1qi6tev/comment/o0v9zh8/", + "#comment" : "'external-preview' embed", + "#class" : reddit.RedditSubmissionExtractor, + "#options" : {"comments": 100}, + "#range" : "2", + "#pattern" : r"https://external-preview.redd.it/0DT-wjorv2NNSSoTW-62QG4xs7ZqGE2jcn2OEa2Xnks\.gif\?width=200&height=200&s=\w+", + "#sha1_content": "5014a016d7d5fb2c9fdaa01f0b43afeff158cd9b", +}, + { "#url" : "https://i.redd.it/upjtjcx2npzz.jpg", "#category": ("", "reddit", "image"),