Important
YouTube is gradually enforcing the use of a "PO Token" to be able to download videos. Due to the nature of these tokens, yt-dlp cannot generate them and they must be provided externally.
By default, yt-dlp will attempt to download videos using clients that do not currently require a PO Token. However, some formats and features may not be available without the token(s).
At this time, it is recommended to use provide a PO Token to use with the web
client. Refer to the PO Token Guide on how to set up yt-dlp for this.
Caution
By using your account with yt-dlp, you run the risk of it being banned (temporarily or permanently). Be mindful with the request rate and amount of downloads you make with an account. Use it only when necessary, or consider using a throwaway account.
Note
This is only necessary for content that requires an account to access, such as private playlists, age-restricted videos and members-only content.
If you are unfamiliar with the basics of exporting cookies and passing them to yt-dlp, then first see How do I pass cookies to yt-dlp?
YouTube rotates account cookies frequently on open YouTube browser tabs as a security measure. To export cookies that will remain working with yt-dlp, you will need to export cookies in such a way that they are never rotated.
One way to do this is through a private browsing/incognito window:
- Open a new private browsing/incognito window and log into YouTube
- Open a new tab and close the YouTube tab
- Export
youtube.com
cookies from the browser then close the private browsing/incognito window so the session is never opened in the browser again.
In some cases, you may not want to use cookies and instead pass Visitor Data to use in Innertube API requests.
Warning
This method is not recommended for most cases. It requires skipping webpage requests so that the VISITOR_INFO1_LIVE
cookie does not interfere. This results in more requests needing to be sent as well as less stable extraction.
You can do this with:
--extractor-args "youtubetab:skip=webpage" --extractor-args "youtube:player_skip=webpage,configs;visitor_data=VISITOR_DATA_VALUE_HERE"
This section has been moved to a dedicated page
Caution
Due to new restrictions enacted by YouTube, logging in with OAuth no longer works with yt-dlp. You should use cookies instead.