Skip to content

Commit

Permalink
[Extractors] Improve YouTube PO Token section (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
  • Loading branch information
coletdjnz and bashonly authored Nov 25, 2024
1 parent d2421fa commit 8d94624
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions Extractors.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
# YouTube


## 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.

One way to do this is through a private browsing/incognito window:
1. Open a new private browsing/incognito window and log into YouTube
2. Open a new tab and **close the YouTube tab**
3. Export cookies from the browser then **close the private browsing/incognito window** so the session is never opened in the browser again.

## Logging in with OAuth

> [!CAUTION]
> Due to new restrictions enacted by YouTube, logging in with OAuth no longer works with yt-dlp. [You should use cookies instead.](#exporting-youtube-cookies)

## PO Token Guide

Proof of Origin (PO) token is a parameter that YouTube requires to be sent with video playback requests from some clients. Without it, requests for the affected clients' format URLs may return HTTP Error 403, or result in your account or IP address being blocked.

This token is generated by BotGuard (Web) / DroidGuard (Android) to attest the requests are coming from a genuine client. This guide will be assuming the use of a PO Token generated by BotGuard, for use with the `web` client.

The token is only valid for a limited time (usually at least 12 hours), so it will need to be refreshed periodically.

> For PO Tokens generated by BotGuard, when logged out, the PO Token is bound to a Visitor ID. This Visitor ID is found in the `VISITOR_INFO1_LIVE` cookie, or in the `visitorData` value which is sent with Innertube API requests. When logged in, the PO Token is bound to the account Session ID (part of the Data Sync ID), rather than the Visitor ID.

Expand Down Expand Up @@ -62,20 +82,5 @@ If you are using cookies, see [Exporting YouTube Cookies](#exporting-youtube-coo
#### Plugins
- [yt-dlp-get-pot](https://github.com/coletdjnz/yt-dlp-get-pot) by [coletdjnz](https://github.com/coletdjnz)
- A plugin framework for yt-dlp to support fetching PO Tokens from external providers

## 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.

One way to do this is through a private browsing/incognito window:
1. Open a new private browsing/incognito window and log into YouTube
2. Open a new tab and **close the YouTube tab**
3. Export cookies from the browser then **close the private browsing/incognito window** so the session is never opened in the browser again.

## Logging in with OAuth

> [!CAUTION]
> Due to new restrictions enacted by YouTube, logging in with OAuth no longer works with yt-dlp. [You should use cookies instead.](#exporting-youtube-cookies)
- [bgutil-ytdlp-pot-provider](https://github.com/Brainicism/bgutil-ytdlp-pot-provider) by [Brainicism](https://github.com/Brainicism)
- A [yt-dlp-get-pot](https://github.com/coletdjnz/yt-dlp-get-pot) provider which uses [BgUtils](https://github.com/LuanRT/BgUtils) to generate PO Tokens

0 comments on commit 8d94624

Please sign in to comment.