mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 01:57:54 +00:00
63 lines
33 KiB
HTML
63 lines
33 KiB
HTML
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Command-line: youtube-dl</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
|
|
MathJax = {
|
|
tex: {
|
|
inlineMath: [ ['$','$'], ['\(','\)'] ],
|
|
displayMath: [ ['$$','$$'], ['[',']'] ]
|
|
},
|
|
options = {
|
|
processHtmlClass = "math"
|
|
}
|
|
}
|
|
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Command-line: youtube-dl</h1><section class="post-metadata"><span>Date: <!-- -->2021-07-08 17:36:26 +08:00</span><span>Date modified: <!-- -->2022-04-22 11:25:43 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"><li class="toc-item toc-item-h1"><a href="/wiki/cli.youtube-dl#synopsis" class="toc-link toc-link-h1">Synopsis</a></li><li class="toc-item toc-item-h1"><a href="/wiki/cli.youtube-dl#options" class="toc-link toc-link-h1">Options</a><ol class="toc-level toc-level-2"><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#output-formats" class="toc-link toc-link-h2">Output formats</a></li><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#date-ranges" class="toc-link toc-link-h2">Date ranges</a></li></ol></li><li class="toc-item toc-item-h1"><a href="/wiki/cli.youtube-dl#examples" class="toc-link toc-link-h1">Examples</a><ol class="toc-level toc-level-2"><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#download-the-thumbnail-and-the-audio-of-the-video" class="toc-link toc-link-h2">Download the thumbnail and the audio of the video</a></li><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#download-an-entire-album" class="toc-link toc-link-h2">Download an entire album</a></li><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#specific-video-download-requirements" class="toc-link toc-link-h2">Specific video download requirements</a></li><li class="toc-item toc-item-h2"><a href="/wiki/cli.youtube-dl#check-the-first-50-videos-at-certain-date-range" class="toc-link toc-link-h2">Check the first 50 videos at certain date range</a></li></ol></li></ol></nav><p>One of the archivists' best friends.
|
|
At least you don't have to go to those shady YouTube conversion sites anymore when you have a <a href="https://ytdl-org.github.io/youtube-dl/supportedsites.html">complete list of other video sites</a> you can download from.
|
|
</p><p>Take note, I use <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>.
|
|
Any yt-dlp-specific options should be in the appropriate note.
|
|
</p><p>For complete information, you can always inspect <code class="inline-verbatim">youtube-dl.1</code> manual page.
|
|
</p><h1 id="synopsis">Synopsis</h1><pre class="src-block"><code class="language-shell">youtube-dl [OPTIONS...] [URLS...]
|
|
</code></pre><h1 id="options">Options</h1><ul><li><p><code class="inline-verbatim">--add-metadata</code> adds metadata to the resulting file after download
|
|
</p></li><li><p><code class="inline-verbatim">--audio-format EXTENSION</code> downloads the video with the select format of "opus", "mp3", "opus", and "vorbis";
|
|
but there is also the convenient "best" option
|
|
</p></li><li><p><code class="inline-verbatim">--audio-quality QUALITY</code> sets the quality of the audio from 0 to 9, best to worst respectively;
|
|
bitrates are also accepted (e.g., <code class="inline-verbatim">320K</code>, <code class="inline-verbatim">1M</code>)
|
|
</p></li><li><p><code class="inline-verbatim">--date RANGE</code> finds videos that are uploaded from a certain date range.
|
|
See the <a href="/wiki/Date%20ranges">Date ranges</a> section to see the format required.
|
|
</p></li><li><p><code class="inline-verbatim">--dateafter RANGE</code> and <code class="inline-verbatim">--datebefore RANGE</code> is a similar option to <code class="inline-verbatim">--date</code> but to find videos before or after the specified date range, respectively.
|
|
Accepts the same format as <code class="inline-verbatim">--date</code>.
|
|
</p></li><li><p><code class="inline-verbatim">--list-extractors</code> prints a list of supported sites and their specific features.
|
|
</p></li><li><p><code class="inline-verbatim">--format QUALITY</code> downloads the video with the format shown in <code class="inline-verbatim">--list-format</code>;
|
|
there are convenient options such as <code class="inline-verbatim">bestaudio</code> and <code class="inline-verbatim">bestvideo</code> referring to the best quality it could find
|
|
</p></li><li><p><code class="inline-verbatim">-o, --output STRING</code> formats the resulting filename of the tracks to be downloaded
|
|
</p></li><li><p><code class="inline-verbatim">--no-overwrite</code> throws an error if the file already exists which is handy for scripts
|
|
</p></li><li><p><code class="inline-verbatim">-x, --extract-audio</code> extracts only the audio track
|
|
</p></li></ul><h2 id="output-formats">Output formats</h2><p>For <code class="inline-verbatim">--output</code> option, there are a lot of things to consider naming your files.
|
|
You may want to automate them yourself but <code class="inline-verbatim">youtube-dl</code> has plenty of options from the get-go.
|
|
</p><p>The following code is the sensible default output string.
|
|
</p><pre class="src-block"><code>%(playlist_index)02d-%(title)s.%(ext)s
|
|
</code></pre><p>A few of the usual stuff I use:
|
|
</p><ul><li><p><code class="inline-verbatim">title</code> (string) is the title of the track
|
|
</p></li><li><p><code class="inline-verbatim">ext</code> (string) is the extension to be used; pretty much recommended to use it
|
|
</p></li><li><p><code class="inline-verbatim">creator</code> (string) and <code class="inline-verbatim">uploader</code> (string)
|
|
</p></li></ul><p>A lot of the things I have to do is to download multiple tracks from an album or playlist.
|
|
Unfortunately, these are often different from one site to another.
|
|
</p><ul><li><p><code class="inline-verbatim">playlist_index</code> (number) indicates the position of the track in a playlist.
|
|
These are usually used from YouTube and Soundcloud playlists.
|
|
</p></li><li><p><code class="inline-verbatim">track_number</code> (number) is the position of the track from an album.
|
|
Usually, these are used from Bandcamp and Vimeo playlists.
|
|
</p></li></ul><h2 id="date-ranges">Date ranges</h2><p>The options <code class="inline-verbatim">--date</code> and the like accept a certain format for date ranges in <code class="inline-verbatim">(now|today)[-|+][\\d+](day|week|month|year)s?</code> or <code class="inline-verbatim">YYYYMMDD</code> for absolute date.
|
|
</p><table><thead><tr><th>Example</th><th>Description</th></tr></thead><tbody><tr><td><code class="inline-verbatim">now-2weeks</code></td><td>From today to 2 weeks ago.</td></tr><tr><td><code class="inline-verbatim">today+3days</code></td><td>From today to 3 days from now.</td></tr><tr><td><code class="inline-verbatim">20000505</code></td><td>Equivalent to <code class="inline-verbatim">2000-05-05</code>.</td></tr></tbody></table><h1 id="examples">Examples</h1><p>Here is an entryway into your newfound archiving habit.
|
|
Enjoy! :)
|
|
</p><h2 id="download-the-thumbnail-and-the-audio-of-the-video">Download the thumbnail and the audio of the video</h2><p>Very simple.
|
|
Very useful as most of the thumbnails can go to high resolution and if you need them for some reason.
|
|
</p><pre class="src-block"><code class="language-shell">youtube-dl --write-thumbnail --extract-audio https://www.youtube.com/watch?v=wy9VvdaLuSs
|
|
</code></pre><h2 id="download-an-entire-album">Download an entire album</h2><p>Though, you should look at the supported sites if it supports downloading an album out of the URL.
|
|
In this example, we have Bandcamp.
|
|
</p><pre class="src-block"><code class="language-shell">youtube-dl --output '%(track_number)02d-%(title)s.%(ext)s' --format bestaudio https://gametal.bandcamp.com/album/side-quests-vol-3
|
|
</code></pre><h2 id="specific-video-download-requirements">Specific video download requirements</h2><p>In this example, I want to download a video with a width of 1080px and the best video and audio at 320Kbit/s.
|
|
Oh, and the video should be in MP4 and the audio in Opus.
|
|
</p><p>This is will only succeed if the format is available to download which you can do with <code class="inline-verbatim">--list-format</code>.
|
|
</p><pre class="src-block"><code class="language-shell">youtube-dl --format 'bestvideo[width=1080,ext=mp4]+bestaudio[abr=320K,ext=opus]' https://www.youtube.com/watch?v=wy9VvdaLuSs
|
|
</code></pre><h2 id="check-the-first-50-videos-at-certain-date-range">Check the first 50 videos at certain date range</h2><p>In this example, I want to download videos from <a href="roam:David Revoy">roam:David Revoy</a>'s YouTube channel that uploaded up to 2 months ago while checking only the first 50 videos.
|
|
This is a useful template especially if the channel has a large selection of videos.
|
|
Also useful if you're checking for videos daily to mitigate against potential bans from overusing it.
|
|
</p><pre class="src-block"><code class="language-shell">youtube-dl --playlist-end 50 --dateafter 'today-2weeks' "https://www.youtube.com/c/DavidRevoy"
|
|
</code></pre></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"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},"page":"/[[...slug]]","query":{"slug":["cli.youtube-dl"]},"buildId":"Ie9t5zutrXP6Of75Cb5xF","assetPrefix":"/wiki","nextExport":false,"isFallback":false,"gsp":true}</script><script nomodule="" src="/wiki/_next/static/chunks/polyfills-99d808df29361cf7ffb1.js"></script><script src="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" async=""></script><script src="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" async=""></script><script src="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" async=""></script><script src="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" async=""></script><script src="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" async=""></script><script src="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" async=""></script><script src="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_buildManifest.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_ssgManifest.js" async=""></script></body></html> |