mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 12:19:31 +00:00
1 line
21 KiB
JSON
1 line
21 KiB
JSON
{"pageProps":{"metadata":{"date":"\"2021-07-08 17:36:26 +08:00\"","date_modified":"\"2022-04-22 11:25:43 +08:00\"","language":"en","source":""},"title":"Command-line: youtube-dl","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"synopsis"},"children":[{"type":"text","value":"Synopsis"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.youtube-dl#synopsis"},"children":[{"type":"text","value":"Synopsis"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.youtube-dl#options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"output-formats"},"children":[{"type":"text","value":"Output formats"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#output-formats"},"children":[{"type":"text","value":"Output formats"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"date-ranges"},"children":[{"type":"text","value":"Date ranges"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#date-ranges"},"children":[{"type":"text","value":"Date ranges"}]}]}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.youtube-dl#examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"download-the-thumbnail-and-the-audio-of-the-video"},"children":[{"type":"text","value":"Download the thumbnail and the audio of the video"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#download-the-thumbnail-and-the-audio-of-the-video"},"children":[{"type":"text","value":"Download the thumbnail and the audio of the video"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"download-an-entire-album"},"children":[{"type":"text","value":"Download an entire album"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#download-an-entire-album"},"children":[{"type":"text","value":"Download an entire album"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"specific-video-download-requirements"},"children":[{"type":"text","value":"Specific video download requirements"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#specific-video-download-requirements"},"children":[{"type":"text","value":"Specific video download requirements"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"check-the-first-50-videos-at-certain-date-range"},"children":[{"type":"text","value":"Check the first 50 videos at certain date range"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.youtube-dl#check-the-first-50-videos-at-certain-date-range"},"children":[{"type":"text","value":"Check the first 50 videos at certain date range"}]}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"One of the archivists' best friends.\nAt least you don't have to go to those shady YouTube conversion sites anymore when you have a "},{"type":"element","tagName":"a","properties":{"href":"https://ytdl-org.github.io/youtube-dl/supportedsites.html"},"children":[{"type":"text","value":"complete list of other video sites"}]},{"type":"text","value":" you can download from.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Take note, I use "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/yt-dlp/yt-dlp"},"children":[{"type":"text","value":"yt-dlp"}]},{"type":"text","value":".\nAny yt-dlp-specific options should be in the appropriate note.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For complete information, you can always inspect "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"youtube-dl.1"}]},{"type":"text","value":" manual page.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"synopsis"},"children":[{"type":"text","value":"Synopsis"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"youtube-dl [OPTIONS...] [URLS...]\n"}]}]},{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--add-metadata"}]},{"type":"text","value":" adds metadata to the resulting file after download\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--audio-format EXTENSION"}]},{"type":"text","value":" downloads the video with the select format of \"opus\", \"mp3\", \"opus\", and \"vorbis\";\n but there is also the convenient \"best\" option\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--audio-quality QUALITY"}]},{"type":"text","value":" sets the quality of the audio from 0 to 9, best to worst respectively;\n bitrates are also accepted (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"320K"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"1M"}]},{"type":"text","value":")\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--date RANGE"}]},{"type":"text","value":" finds videos that are uploaded from a certain date range.\n See the "},{"type":"element","tagName":"a","properties":{"href":"/Date%20ranges"},"children":[{"type":"text","value":"Date ranges"}]},{"type":"text","value":" section to see the format required.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--dateafter RANGE"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--datebefore RANGE"}]},{"type":"text","value":" is a similar option to "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--date"}]},{"type":"text","value":" but to find videos before or after the specified date range, respectively.\n Accepts the same format as "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--date"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--list-extractors"}]},{"type":"text","value":" prints a list of supported sites and their specific features.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--format QUALITY"}]},{"type":"text","value":" downloads the video with the format shown in "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--list-format"}]},{"type":"text","value":";\n there are convenient options such as "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"bestaudio"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"bestvideo"}]},{"type":"text","value":" referring to the best quality it could find\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o, --output STRING"}]},{"type":"text","value":" formats the resulting filename of the tracks to be downloaded\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--no-overwrite"}]},{"type":"text","value":" throws an error if the file already exists which is handy for scripts\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-x, --extract-audio"}]},{"type":"text","value":" extracts only the audio track\n"}]}]}]},{"type":"element","tagName":"h2","properties":{"id":"output-formats"},"children":[{"type":"text","value":"Output formats"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--output"}]},{"type":"text","value":" option, there are a lot of things to consider naming your files.\nYou may want to automate them yourself but "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"youtube-dl"}]},{"type":"text","value":" has plenty of options from the get-go.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The following code is the sensible default output string.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"%(playlist_index)02d-%(title)s.%(ext)s\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"A few of the usual stuff I use:\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"title"}]},{"type":"text","value":" (string) is the title of the track\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"ext"}]},{"type":"text","value":" (string) is the extension to be used; pretty much recommended to use it\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"creator"}]},{"type":"text","value":" (string) and "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"uploader"}]},{"type":"text","value":" (string)\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"A lot of the things I have to do is to download multiple tracks from an album or playlist.\nUnfortunately, these are often different from one site to another.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"playlist_index"}]},{"type":"text","value":" (number) indicates the position of the track in a playlist.\n These are usually used from YouTube and Soundcloud playlists.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"track_number"}]},{"type":"text","value":" (number) is the position of the track from an album.\n Usually, these are used from Bandcamp and Vimeo playlists.\n"}]}]}]},{"type":"element","tagName":"h2","properties":{"id":"date-ranges"},"children":[{"type":"text","value":"Date ranges"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The options "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--date"}]},{"type":"text","value":" and the like accept a certain format for date ranges in "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"(now|today)[-|+][\\\\d+](day|week|month|year)s?"}]},{"type":"text","value":" or "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"YYYYMMDD"}]},{"type":"text","value":" for absolute date.\n"}]},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Example"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"now-2weeks"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"From today to 2 weeks ago."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"today+3days"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"From today to 3 days from now."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"20000505"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Equivalent to "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"2000-05-05"}]},{"type":"text","value":"."}]}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Here is an entryway into your newfound archiving habit.\nEnjoy! :)\n"}]},{"type":"element","tagName":"h2","properties":{"id":"download-the-thumbnail-and-the-audio-of-the-video"},"children":[{"type":"text","value":"Download the thumbnail and the audio of the video"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Very simple.\nVery useful as most of the thumbnails can go to high resolution and if you need them for some reason.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"youtube-dl --write-thumbnail --extract-audio https://www.youtube.com/watch?v=wy9VvdaLuSs\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"download-an-entire-album"},"children":[{"type":"text","value":"Download an entire album"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Though, you should look at the supported sites if it supports downloading an album out of the URL.\nIn this example, we have Bandcamp.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"youtube-dl --output '%(track_number)02d-%(title)s.%(ext)s' --format bestaudio https://gametal.bandcamp.com/album/side-quests-vol-3\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"specific-video-download-requirements"},"children":[{"type":"text","value":"Specific video download requirements"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In this example, I want to download a video with a width of 1080px and the best video and audio at 320Kbit/s.\nOh, and the video should be in MP4 and the audio in Opus.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"This is will only succeed if the format is available to download which you can do with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--list-format"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"youtube-dl --format 'bestvideo[width=1080,ext=mp4]+bestaudio[abr=320K,ext=opus]' https://www.youtube.com/watch?v=wy9VvdaLuSs\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"check-the-first-50-videos-at-certain-date-range"},"children":[{"type":"text","value":"Check the first 50 videos at certain date range"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In this example, I want to download videos from "},{"type":"element","tagName":"a","properties":{"href":"roam:David Revoy"},"children":[{"type":"text","value":"roam:David Revoy"}]},{"type":"text","value":"'s YouTube channel that uploaded up to 2 months ago while checking only the first 50 videos.\nThis is a useful template especially if the channel has a large selection of videos.\nAlso useful if you're checking for videos daily to mitigate against potential bans from overusing it.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"youtube-dl --playlist-end 50 --dateafter 'today-2weeks' \"https://www.youtube.com/c/DavidRevoy\"\n"}]}]}]},"backlinks":[]},"__N_SSG":true} |