From 8d946242b3df93271961d6bee0f004bd21f4f9ee Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Tue, 26 Nov 2024 08:05:07 +1300 Subject: [PATCH] [Extractors] Improve YouTube PO Token section (#49) Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- Extractors.md | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Extractors.md b/Extractors.md index 07e7e70..91e5f3c 100644 --- a/Extractors.md +++ b/Extractors.md @@ -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. @@ -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 \ No newline at end of file