[Extractors] Remove YouTube OAuth section (#48)

coletdjnz 2024-11-16 10:56:32 +13:00 committed by GitHub
parent 7bfc65545b
commit 619f9fd83f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 26 deletions

@ -65,6 +65,8 @@ If you are using cookies, see [Exporting YouTube Cookies](#exporting-youtube-coo
## Exporting YouTube cookies
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?](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp)
YouTube rotates 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.
@ -75,30 +77,5 @@ One way to do this is through a private browsing/incognito window:
## Logging in with OAuth
An alternative to using cookies is to log in with OAuth. This method avoids the need to export cookies.
> [!CAUTION]
> Only use one method of authentication at a time. Using both cookies and OAuth at the same time may cause issues.
Enable logging in with OAuth by passing `--username=oauth --password=""` to yt-dlp. You can add this to your [yt-dlp config file](https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#configuration), but this will result in yt-dlp trying to use this username/password combination for all sites. If you only want to apply this for the YouTube extractors, you can add the following to a [.netrc file](https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#authentication-with-netrc):
```
machine youtube login oauth password ""
```
You can optionally supply a custom profile name that the account credentials will be saved under with `--username=oauth+MY_PROFILE`. This allows you to switch between multiple accounts. Otherwise, the default profile is used.
A refresh token can optionally be supplied as the password. This may be useful if cache is disabled, or you want to initialize the cache from the refresh token.
### Logging in
On first run you will be prompted to authorize yt-dlp to access your YouTube account.
> [youtube] oauth: Initializing authorization flow
>
> [youtube] oauth: To give yt-dlp access to your account, go to https://www.google.com/device and enter code XXX-YYY-ZZZ
Open the link in your browser and enter the code. It will say the request is for YouTube on TV -- this is expected, since we are using the YouTube on TV client for oauth.
The token data is saved in the yt-dlp cache (you can specify a custom cache location with `--cache-dir`).
If you encounter issues, run yt-dlp with verbose logging (`-v`). If you see `oauth: Logged in using profile "XXX"`, then yt-dlp is attempting to use oauth.
> Due to new restrictions enacted by YouTube, logging in with OAuth is no longer works for yt-dlp. [You should use cookies instead.](#exporting-youtube-cookies)