ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.76k stars 10.08k forks source link

[Reddit] Downloading embedded videos in text posts #26131

Open 001Guy001 opened 4 years ago

001Guy001 commented 4 years ago

Checklist

Verbose log

C:\youtube-dl.exe -v -o "%(id)s.%(ext)s" -x https://www.reddit.com/r/NameThatSong/comments/hx4xcb/type_uptempo_melody_recreated_on_piano/
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-o', '%(id)s.%(ext)s', '-x', 'https://www.reddit.com/r/NameThatSong/comments/hx4xcb/type_uptempo_melody_recreated_on_piano/']
[debug] Encodings: locale cp65001, fs mbcs, out cp65001, pref cp65001
[debug] youtube-dl version 2020.06.16.1
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[debug] exe versions: none
[debug] Proxy map: {}
[RedditR] hx4xcb: Downloading JSON metadata
ERROR: No media found
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpspbsbtmq\build\youtube_dl\YoutubeDL.py", line 797, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpspbsbtmq\build\youtube_dl\extractor\common.py", line 530, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpspbsbtmq\build\youtube_dl\extractor\reddit.py", line 109, in _real_extract
youtube_dl.utils.ExtractorError: No media found

Description

I'd like to suggest adding the ability to download videos from embedded videos that are in this format: https://reddit.com/link/---/video/---/player

leemetme commented 3 years ago

A quick workaround for those looking for a solution:

  1. Navigate to the .json page of the Reddit post you would like to download the video from. For example, when you're on https://www.reddit.com/r/NameThatSong/comments/hx4xcb/type_uptempo_melody_recreated_on_piano/ you'll have to navigate to https://www.reddit.com/r/NameThatSong/comments/hx4xcb/type_uptempo_melody_recreated_on_piano/.json.
  2. Next, find the value for the "hlsUrl" key in the JSON file.
  3. Feed the URL from the hlsUrl key to youtube-dl with the --force-generic-extractor argument. In this case, the command to execute would be: youtube-dl https://v.redd.it/link/hx4xcb/asset/92082l8w0uc51/HLSPlaylist.m3u8 --force-generic-extractor