差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
python:yt-dlp [2023/03/08 21:56] – ともやん | python:yt-dlp [2023/03/09 21:10] (現在) – ともやん | ||
---|---|---|---|
行 57: | 行 57: | ||
===== 使用方法 ===== | ===== 使用方法 ===== | ||
+ | |||
+ | ==== ヘルプ [-h, --help] ==== | ||
+ | 詳細は [[git> | ||
+ | |||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | (pyMusicEnv) <b class=GRN> | ||
+ | </ | ||
+ | <WRAP color_result_long>< | ||
+ | Usage: yt-dlp [OPTIONS] URL [URL...] | ||
+ | |||
+ | Options: | ||
+ | General Options: | ||
+ | -h, --help | ||
+ | --version | ||
+ | -U, --update | ||
+ | or using the wheel from PyPi; Use that to update | ||
+ | --no-update | ||
+ | --update-to [CHANNEL]@[TAG] | ||
+ | | ||
+ | See " | ||
+ | -i, --ignore-errors | ||
+ | be considered successful even if the postprocessing fails | ||
+ | --no-abort-on-error | ||
+ | | ||
+ | --abort-on-error | ||
+ | | ||
+ | --dump-user-agent | ||
+ | --list-extractors | ||
+ | --extractor-descriptions | ||
+ | --use-extractors NAMES | ||
+ | | ||
+ | --ies " | ||
+ | | ||
+ | | ||
+ | --default-search PREFIX | ||
+ | | ||
+ | " | ||
+ | | ||
+ | just throws an error. The default value " | ||
+ | | ||
+ | | ||
+ | --ignore-config | ||
+ | | ||
+ | | ||
+ | user configuration is not loaded. (Alias: --no-config) | ||
+ | --no-config-locations | ||
+ | given inside a configuration file, ignore all previous | ||
+ | | ||
+ | --config-locations PATH Location of the main configuration file; either the path to | ||
+ | the config or its containing directory (" | ||
+ | be used multiple times and inside other configuration files | ||
+ | --flat-playlist | ||
+ | --no-flat-playlist | ||
+ | --live-from-start | ||
+ | for YouTube (Experimental) | ||
+ | --no-live-from-start | ||
+ | --wait-for-video MIN[-MAX] | ||
+ | | ||
+ | --no-wait-for-video | ||
+ | --mark-watched | ||
+ | --no-mark-watched | ||
+ | --no-colors | ||
+ | --compat-options OPTS Options that can help keep compatibility with youtube-dl or | ||
+ | | ||
+ | made in yt-dlp. See " | ||
+ | | ||
+ | --alias ALIASES OPTIONS | ||
+ | with a dash " | ||
+ | | ||
+ | | ||
+ | | ||
+ | that takes an argument (ARG0) and expands to | ||
+ | " | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Network Options: | ||
+ | --proxy URL Use the specified HTTP/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | --socket-timeout SECONDS | ||
+ | --source-address IP Client-side IP address to bind to | ||
+ | -4, --force-ipv4 | ||
+ | -6, --force-ipv6 | ||
+ | --enable-file-urls | ||
+ | | ||
+ | |||
+ | Geo-restriction: | ||
+ | --geo-verification-proxy URL Use this proxy to verify the IP address for some geo- | ||
+ | | ||
+ | none, if the option is not present) is used for the actual | ||
+ | | ||
+ | --geo-bypass | ||
+ | | ||
+ | --no-geo-bypass | ||
+ | For HTTP header | ||
+ | --geo-bypass-country CODE Force bypass geographic restriction with explicitly provided | ||
+ | | ||
+ | --geo-bypass-ip-block IP_BLOCK | ||
+ | IP block in CIDR notation | ||
+ | |||
+ | Video Selection: | ||
+ | -I, --playlist-items ITEM_SPEC | ||
+ | can specify a range using " | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | --min-filesize SIZE Abort download if filesize is smaller than SIZE, e.g. 50k or | ||
+ | 44.6M | ||
+ | --max-filesize SIZE Abort download if filesize is larger than SIZE, e.g. 50k or | ||
+ | 44.6M | ||
+ | --date DATE Download only videos uploaded on this date. The date can be | ||
+ | " | ||
+ | | ||
+ | | ||
+ | two weeks ago | ||
+ | --datebefore DATE Download only videos uploaded on or before this date. The | ||
+ | date formats accepted is the same as --date | ||
+ | --dateafter DATE | ||
+ | | ||
+ | --match-filters FILTER | ||
+ | | ||
+ | | ||
+ | field to match if the field is present, use " | ||
+ | if the field is not present, and "&" | ||
+ | | ||
+ | used multiple times, the filter matches if atleast one of the | ||
+ | | ||
+ | | ||
+ | | ||
+ | have a like count more than 100 (or the like field is not | ||
+ | | ||
+ | | ||
+ | | ||
+ | --no-match-filter | ||
+ | --break-match-filters FILTER | ||
+ | a video is rejected | ||
+ | --no-break-match-filters | ||
+ | --no-playlist | ||
+ | | ||
+ | --yes-playlist | ||
+ | | ||
+ | --age-limit YEARS Download only videos suitable for the given age | ||
+ | --download-archive FILE Download only videos not listed in the archive file. Record | ||
+ | the IDs of all downloaded videos in it | ||
+ | --no-download-archive | ||
+ | --max-downloads NUMBER | ||
+ | --break-on-existing | ||
+ | the archive | ||
+ | --break-per-input | ||
+ | | ||
+ | --no-break-per-input | ||
+ | | ||
+ | --skip-playlist-after-errors N | ||
+ | | ||
+ | |||
+ | Download Options: | ||
+ | -N, --concurrent-fragments N | ||
+ | | ||
+ | -r, --limit-rate RATE Maximum download rate in bytes per second, e.g. 50K or 4.2M | ||
+ | --throttled-rate RATE Minimum download rate in bytes per second below which | ||
+ | | ||
+ | e.g. 100K | ||
+ | -R, --retries RETRIES | ||
+ | --file-access-retries RETRIES | ||
+ | or " | ||
+ | --fragment-retries RETRIES | ||
+ | " | ||
+ | --retry-sleep [TYPE: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | times to set the sleep for the different retry types, e.g. | ||
+ | | ||
+ | --skip-unavailable-fragments | ||
+ | | ||
+ | | ||
+ | --abort-on-unavailable-fragments | ||
+ | | ||
+ | --keep-fragments | ||
+ | | ||
+ | --no-keep-fragments | ||
+ | | ||
+ | --buffer-size SIZE Size of download buffer, e.g. 1024 or 16K (default is 1024) | ||
+ | --resize-buffer | ||
+ | value of --buffer-size (default) | ||
+ | --no-resize-buffer | ||
+ | --http-chunk-size SIZE Size of a chunk for chunk-based HTTP downloading, | ||
+ | | ||
+ | | ||
+ | | ||
+ | --playlist-random | ||
+ | --lazy-playlist | ||
+ | | ||
+ | --no-lazy-playlist | ||
+ | is parsed (default) | ||
+ | --xattr-set-filesize | ||
+ | --hls-use-mpegts | ||
+ | | ||
+ | | ||
+ | | ||
+ | --no-hls-use-mpegts | ||
+ | | ||
+ | --download-sections REGEX Download only chapters whose title matches the given regular | ||
+ | | ||
+ | place of chapters to download the specified range. Needs | ||
+ | | ||
+ | | ||
+ | | ||
+ | --downloader [PROTO: | ||
+ | | ||
+ | mms) to use it for. Currently supports native, aria2c, | ||
+ | | ||
+ | | ||
+ | | ||
+ | " | ||
+ | and the native downloader for dash/m3u8 downloads (Alias: | ||
+ | | ||
+ | --downloader-args NAME: | ||
+ | | ||
+ | For ffmpeg, arguments can be passed to different positions | ||
+ | using the same syntax as --postprocessor-args. You can use | ||
+ | this option multiple times to give different arguments to | ||
+ | | ||
+ | |||
+ | Filesystem Options: | ||
+ | -a, --batch-file FILE File containing URLs to download (" | ||
+ | line. Lines starting with "#", | ||
+ | | ||
+ | --no-batch-file | ||
+ | -P, --paths [TYPES: | ||
+ | type of file and the path separated by a colon ":" | ||
+ | same TYPES as --output are supported. Additionally, | ||
+ | also provide " | ||
+ | | ||
+ | then the final files are moved over to the home path after | ||
+ | | ||
+ | an absolute path | ||
+ | -o, --output [TYPES: | ||
+ | --output-na-placeholder TEXT | ||
+ | | ||
+ | --restrict-filenames | ||
+ | and spaces in filenames | ||
+ | --no-restrict-filenames | ||
+ | | ||
+ | --windows-filenames | ||
+ | --no-windows-filenames | ||
+ | | ||
+ | --trim-filenames LENGTH | ||
+ | | ||
+ | -w, --no-overwrites | ||
+ | --force-overwrites | ||
+ | | ||
+ | --no-force-overwrites | ||
+ | | ||
+ | -c, --continue | ||
+ | --no-continue | ||
+ | not fragmented, restart download of the entire file | ||
+ | --part | ||
+ | | ||
+ | --no-part | ||
+ | --mtime | ||
+ | time (default) | ||
+ | --no-mtime | ||
+ | | ||
+ | --write-description | ||
+ | --no-write-description | ||
+ | --write-info-json | ||
+ | | ||
+ | --no-write-info-json | ||
+ | --write-playlist-metafiles | ||
+ | when using --write-info-json, | ||
+ | | ||
+ | --no-write-playlist-metafiles | ||
+ | | ||
+ | --clean-info-json | ||
+ | | ||
+ | | ||
+ | --no-clean-info-json | ||
+ | --write-comments | ||
+ | | ||
+ | | ||
+ | --no-write-comments | ||
+ | to be quick (Alias: --no-get-comments) | ||
+ | --load-info-json FILE JSON file containing the video information (created with the | ||
+ | " | ||
+ | --cookies FILE | ||
+ | jar in | ||
+ | --no-cookies | ||
+ | --cookies-from-browser BROWSER[+KEYRING][: | ||
+ | The name of the browser to load cookies from. Currently | ||
+ | | ||
+ | | ||
+ | for decrypting Chromium cookies on Linux, the name/path of | ||
+ | the PROFILE to load cookies from, and the CONTAINER name (if | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | --no-cookies-from-browser | ||
+ | --cache-dir DIR Location in the filesystem where yt-dlp can store some | ||
+ | | ||
+ | | ||
+ | --no-cache-dir | ||
+ | --rm-cache-dir | ||
+ | |||
+ | Thumbnail Options: | ||
+ | --write-thumbnail | ||
+ | --no-write-thumbnail | ||
+ | --write-all-thumbnails | ||
+ | --list-thumbnails | ||
+ | | ||
+ | |||
+ | Internet Shortcut Options: | ||
+ | --write-link | ||
+ | | ||
+ | by the OS | ||
+ | --write-url-link | ||
+ | based on the file path | ||
+ | --write-webloc-link | ||
+ | --write-desktop-link | ||
+ | |||
+ | Verbosity and Simulation Options: | ||
+ | -q, --quiet | ||
+ | | ||
+ | --no-warnings | ||
+ | -s, --simulate | ||
+ | --no-simulate | ||
+ | --ignore-no-formats-error | ||
+ | | ||
+ | | ||
+ | --no-ignore-no-formats-error | ||
+ | | ||
+ | --skip-download | ||
+ | | ||
+ | -O, --print [WHEN: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | can be used multiple times | ||
+ | --print-to-file [WHEN: | ||
+ | | ||
+ | | ||
+ | | ||
+ | -j, --dump-json | ||
+ | | ||
+ | | ||
+ | -J, --dump-single-json | ||
+ | | ||
+ | | ||
+ | | ||
+ | --force-write-archive | ||
+ | | ||
+ | | ||
+ | --newline | ||
+ | --no-progress | ||
+ | --progress | ||
+ | --console-title | ||
+ | --progress-template [TYPES: | ||
+ | of " | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -v, --verbose | ||
+ | --dump-pages | ||
+ | (very verbose) | ||
+ | --write-pages | ||
+ | | ||
+ | --print-traffic | ||
+ | |||
+ | Workarounds: | ||
+ | --encoding ENCODING | ||
+ | --legacy-server-connect | ||
+ | | ||
+ | --no-check-certificates | ||
+ | --prefer-insecure | ||
+ | the video (Currently supported only for YouTube) | ||
+ | --add-headers FIELD: | ||
+ | colon ":" | ||
+ | --bidi-workaround | ||
+ | | ||
+ | --sleep-requests SECONDS | ||
+ | | ||
+ | --sleep-interval SECONDS | ||
+ | | ||
+ | | ||
+ | --max-sleep-interval SECONDS | ||
+ | with --min-sleep-interval | ||
+ | --sleep-subtitles SECONDS | ||
+ | |||
+ | Video Format Options: | ||
+ | -f, --format FORMAT | ||
+ | -S, --format-sort SORTORDER | ||
+ | for more details | ||
+ | --format-sort-force | ||
+ | | ||
+ | | ||
+ | --no-format-sort-force | ||
+ | order (default) | ||
+ | --video-multistreams | ||
+ | --no-video-multistreams | ||
+ | | ||
+ | --audio-multistreams | ||
+ | --no-audio-multistreams | ||
+ | | ||
+ | --prefer-free-formats | ||
+ | of same quality. Use with "-S ext" to strictly prefer free | ||
+ | | ||
+ | --no-prefer-free-formats | ||
+ | | ||
+ | --check-formats | ||
+ | | ||
+ | --check-all-formats | ||
+ | --no-check-formats | ||
+ | -F, --list-formats | ||
+ | | ||
+ | --merge-output-format FORMAT | ||
+ | by "/", | ||
+ | | ||
+ | |||
+ | Subtitle Options: | ||
+ | --write-subs | ||
+ | --no-write-subs | ||
+ | --write-auto-subs | ||
+ | | ||
+ | --no-write-auto-subs | ||
+ | | ||
+ | --list-subs | ||
+ | | ||
+ | --sub-format FORMAT | ||
+ | " | ||
+ | --sub-langs LANGS Languages of the subtitles to download (can be regex) or | ||
+ | " | ||
+ | can prefix the language code with a " | ||
+ | the requested languages, e.g. --sub-langs all, | ||
+ | | ||
+ | |||
+ | Authentication Options: | ||
+ | -u, --username USERNAME | ||
+ | -p, --password PASSWORD | ||
+ | | ||
+ | -2, --twofactor TWOFACTOR | ||
+ | -n, --netrc | ||
+ | --netrc-location PATH Location of .netrc authentication data; either the path or | ||
+ | its containing directory. Defaults to ~/.netrc | ||
+ | --video-password PASSWORD | ||
+ | --ap-mso MSO Adobe Pass multiple-system operator (TV provider) identifier, | ||
+ | use --ap-list-mso for a list of available MSOs | ||
+ | --ap-username USERNAME | ||
+ | --ap-password PASSWORD | ||
+ | left out, yt-dlp will ask interactively | ||
+ | --ap-list-mso | ||
+ | --client-certificate CERTFILE | ||
+ | the private key | ||
+ | --client-certificate-key KEYFILE | ||
+ | --client-certificate-password PASSWORD | ||
+ | not provided, and the key is encrypted, yt-dlp will ask | ||
+ | | ||
+ | |||
+ | Post-Processing Options: | ||
+ | -x, --extract-audio | ||
+ | | ||
+ | --audio-format FORMAT | ||
+ | | ||
+ | | ||
+ | | ||
+ | --audio-quality QUALITY | ||
+ | with -x. Insert a value between 0 (best) and 10 (worst) for | ||
+ | VBR or a specific bitrate like 128K (default 5) | ||
+ | --remux-video FORMAT | ||
+ | | ||
+ | aac, aiff, alac, flac, m4a, mka, mp3, ogg, opus, vorbis, | ||
+ | wav). If target container does not support the video/audio | ||
+ | | ||
+ | e.g. " | ||
+ | and anything else to mkv | ||
+ | --recode-video FORMAT | ||
+ | | ||
+ | --postprocessor-args NAME: | ||
+ | | ||
+ | a colon ":" | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | You can also specify " | ||
+ | the specified executable only when being used by the | ||
+ | | ||
+ | " | ||
+ | by a number to pass the argument before the specified | ||
+ | | ||
+ | You can use this option multiple times to give different | ||
+ | | ||
+ | -k, --keep-video | ||
+ | | ||
+ | --no-keep-video | ||
+ | | ||
+ | --post-overwrites | ||
+ | --no-post-overwrites | ||
+ | --embed-subs | ||
+ | | ||
+ | --no-embed-subs | ||
+ | --embed-thumbnail | ||
+ | --no-embed-thumbnail | ||
+ | --embed-metadata | ||
+ | | ||
+ | | ||
+ | --no-embed-metadata | ||
+ | | ||
+ | --embed-chapters | ||
+ | --no-embed-chapters | ||
+ | | ||
+ | --embed-info-json | ||
+ | --no-embed-info-json | ||
+ | --parse-metadata [WHEN: | ||
+ | | ||
+ | | ||
+ | | ||
+ | --replace-in-metadata [WHEN: | ||
+ | | ||
+ | | ||
+ | are the same as that of --use-postprocessor (default: | ||
+ | | ||
+ | --xattrs | ||
+ | and xdg standards) | ||
+ | --concat-playlist POLICY | ||
+ | or " | ||
+ | | ||
+ | of streams to be concatable. The " | ||
+ | used with " | ||
+ | for the concatenated files. See " | ||
+ | --fixup POLICY | ||
+ | (do nothing), warn (only emit a warning), detect_or_warn (the | ||
+ | | ||
+ | | ||
+ | --ffmpeg-location PATH | ||
+ | or its containing directory | ||
+ | --exec [WHEN: | ||
+ | it, separated by a ":" | ||
+ | same as that of --use-postprocessor (default: after_move). | ||
+ | Same syntax as the output template can be used to pass any | ||
+ | field as arguments to the command. After download, an | ||
+ | | ||
+ | the downloaded file is also available, and if no fields are | ||
+ | | ||
+ | | ||
+ | --no-exec | ||
+ | --convert-subs FORMAT | ||
+ | ass, lrc, srt, vtt) (Alias: --convert-subtitles) | ||
+ | --convert-thumbnails FORMAT | ||
+ | | ||
+ | using similar syntax as --remux-video | ||
+ | --split-chapters | ||
+ | The " | ||
+ | | ||
+ | " | ||
+ | --no-split-chapters | ||
+ | --remove-chapters REGEX Remove chapters whose title matches the given regular | ||
+ | | ||
+ | This option can be used multiple times | ||
+ | --no-remove-chapters | ||
+ | --force-keyframes-at-cuts | ||
+ | | ||
+ | | ||
+ | --no-force-keyframes-at-cuts | ||
+ | | ||
+ | --use-postprocessor NAME[: | ||
+ | | ||
+ | | ||
+ | list of NAME=VALUE. The " | ||
+ | | ||
+ | | ||
+ | | ||
+ | " | ||
+ | | ||
+ | | ||
+ | | ||
+ | " | ||
+ | | ||
+ | |||
+ | SponsorBlock Options: | ||
+ | Make chapter entries for, or remove various segments (sponsor, introductions, | ||
+ | YouTube videos using the SponsorBlock API (https:// | ||
+ | |||
+ | --sponsorblock-mark CATS | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | --sponsorblock-remove CATS | ||
+ | | ||
+ | and remove, remove takes precedence. The syntax and available | ||
+ | | ||
+ | that " | ||
+ | | ||
+ | --sponsorblock-chapter-title TEMPLATE | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | --no-sponsorblock | ||
+ | --sponsorblock-api URL | ||
+ | | ||
+ | |||
+ | Extractor Options: | ||
+ | --extractor-retries RETRIES | ||
+ | or " | ||
+ | --allow-dynamic-mpd | ||
+ | | ||
+ | --ignore-dynamic-mpd | ||
+ | | ||
+ | --hls-split-discontinuity | ||
+ | such as ad breaks | ||
+ | --no-hls-split-discontinuity | ||
+ | | ||
+ | --extractor-args IE_KEY: | ||
+ | | ||
+ | times to give arguments for different extractors | ||
+ | |||
+ | See full documentation at https:// | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== 利用可能なビデオ形式の一覧表示 [-F, --list-formats] ==== | ||
+ | [[git> | ||
+ | <WRAP mintbl> | ||
+ | | <WRAP youtube>< | ||
+ | <iframe width=" | ||
+ | allow=" | ||
+ | </ | ||
+ | | Jack Frederic - Life Is Good %%|%% UNTOLD\\ クリエイティブ・コモンズ ライセンス | ||
+ | </ | ||
+ | |||
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
行 99: | 行 748: | ||
</ | </ | ||
+ | ==== ビデオ形式の選択 [-f, --format FORMAT] ==== | ||
+ | [[git> | ||
+ | 詳細は [[git> | ||
+ | ビデオ形式選択のサンプルは [[git> | ||
+ | \\ | ||
+ | < | ||
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
行 119: | 行 774: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ==== 実行例 1 ==== | ||
+ | <WRAP mintbl> | ||
+ | | <WRAP youtube>< | ||
+ | <iframe width=" | ||
+ | allow=" | ||
+ | </ | ||
+ | | Jack Frederic - Better Mood (Official Music Video) [4K]\\ クリエイティブ・コモンズ ライセンス | ||
<WRAP color_term> | <WRAP color_term> | ||
行 183: | 行 846: | ||
Deleting original file Jack Frederic - Better Mood (Official Music Video) [4K] [demxdwo3JFU].f313.webm (pass -k to keep) | Deleting original file Jack Frederic - Better Mood (Official Music Video) [4K] [demxdwo3JFU].f313.webm (pass -k to keep) | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | ==== 実行例 2 ==== | ||
+ | <WRAP mintbl> | ||
+ | | <WRAP youtube>< | ||
+ | <iframe width=" | ||
+ | allow=" | ||
+ | </ | ||
+ | | Tomorrowland 2018 Belgium 4k\\ クリエイティブ・コモンズ ライセンス | ||
</ | </ | ||
行 194: | 行 866: | ||
[youtube] XniH2xgtp0s: | [youtube] XniH2xgtp0s: | ||
[info] Available formats for XniH2xgtp0s: | [info] Available formats for XniH2xgtp0s: | ||
- | <b class=HIR> | + | <b class=HIR> |
<b class=HIB> | <b class=HIB> | ||
<b class=HIG> | <b class=HIG> | ||
行 245: | 行 917: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ===== 参考文献 ===== | ||
+ | |||
+ | ==== 付録 ==== | ||
+ | [[tw> | ||