Bus errorとSegmentation faultに困ったら見るブログ

物理の研究者による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【yt-dlp】Sign in to confirm your age. This video may be inappropriate と出たときの対処方法

githubのF&Qに答えがあった

github.com

How do I pass cookies to yt-dlp?
Passing cookies to yt-dlp is a good way to workaround login when a particular extractor does not implement it explicitly. Another use case is working around CAPTCHA some websites require you to solve in particular cases in order to get access (e.g. YouTube, CloudFlare).

The easiest way to pass cookies is to let yt-dlp extract it from your browser (say, Chrome) using --cookies-from-browser chrome. In Linux, this searches for config in location ~/.config/google-chrome. In case you install Chrome using Flatpak, the config is located in ~/.var/app/com.google.Chrome. To pass the cookies from this location use --cookies-from-browser chrome:~/.var/app/com.google.Chrome/

If you wish to manually pass cookies, use the --cookies option, for example: --cookies /path/to/cookies/file.txt.

You can export your cookies to a text file without any third-party software by using yt-dlp's --cookies-from-browser option in conjunction with the --cookies option, for example: yt-dlp --cookies-from-browser chrome --cookies cookies.txt. yt-dlp will extract the browser cookies and save them to the filepath specified after --cookies. The resulting text file can then be used with the --cookies option. Note though that this method exports your browser's cookies for ALL sites (even if you passed a URL to yt-dlp), so take care in not letting this text file fall into the wrong hands.

You may also use a conforming browser extension for exporting cookies, such as Get cookies.txt LOCALLY for Chrome or cookies.txt for Firefox. As with any browser extension, be careful about what you install. If you had previously installed the "Get cookies.txt" (not "LOCALLY") Chrome extension, it's recommended to uninstall it immediately; it has been reported as malware and removed from the Chrome Web Store.

Note that the cookies file must be in Mozilla/Netscape format and the first line of the cookies file must be either # HTTP Cookie File or # Netscape HTTP Cookie File. Make sure you have correct newline format in the cookies file and convert newlines if necessary to correspond with your OS, namely CRLF (\r\n) for Windows and LF (\n) for Unix and Unix-like systems (Linux, macOS, etc.). HTTP Error 400: Bad Request when using --cookies is a good sign of invalid newline format.

coocies.txtをダウンロードする

それをどこかに置いて、それをyt-dlpにオプションで渡せばいい

 --cookies /path/to/cookies/file.txt

みたいな感じでOK


ランキング参加中です

↓クリックしていただけると嬉しいです〜