You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PO Token Guide.md
+26-88Lines changed: 26 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
# YouTube PO Token Guide
4
4
5
5
> [!TIP]
6
-
> TL;DR recommended setup: Either use a [PO Token Provider plugin](#po-token-provider-plugins), or [manual extraction](#guide-providing-a-po-token-manually-for-use-with-mweb-client), to provide the `mweb` client with a [PO Token for GVS requests](#cases-where-a-po-token-is-required).
6
+
> TL;DR recommended setup: Use a [PO Token Provider plugin](#po-token-provider-plugins) to provide the `mweb` client with a [PO Token for GVS requests](#cases-where-a-po-token-is-required).
7
7
>
8
8
> See the notice in the [YouTube Extractor Wiki](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#youtube) for more information on the current state of downloading videos from YouTube.
9
9
@@ -15,15 +15,8 @@
15
15
*[Current PO Token enforcement](#current-po-token-enforcement)
|`web_safari`| GVS*| Same as `web`. *Provides HLS (m3u8) formats which do not require PO Token for GVS at this time. |
50
+
|`mweb`| GVS ||
51
+
|`tv`| Not required | All formats DRM'd if cookies (logged-in or active guest) aren't passed. Only SABR formats available in some cases |
52
+
|`tv_simply`| GVS | Account cookies not supported |
53
+
|`web_embedded`| Not required | Only embeddable videos available |
54
+
|`web_music`| GVS ||
55
+
|`web_creator`| GVS | Requires account cookies |
56
+
|`android`| GVS or Player | Account cookies not supported |
57
+
|`android_vr`| Not required | "Made for kids" videos are not available |
58
+
|`ios`| GVS or Player | Account cookies not supported |
67
59
68
60
For all clients:
69
61
- GVS PO Token is not required for YouTube Premium subscribers
@@ -76,62 +68,24 @@ You can select what client to use with the [`player_client` extractor argument](
76
68
> [!TIP]
77
69
> Recommended
78
70
79
-
Manually fetching PO Tokens can be a tedious process. As an alternative, you can install a PO Token Provider plugin to handle fetching PO Tokens automatically.
71
+
Manually extracting PO Tokens is no longer recommended. YouTube now binds PO Tokens to the video ID, so a new token needs to be generated for each video.
72
+
73
+
It is recommended to use a PO Token Provider plugin to automatically fetch and provide PO Tokens to yt-dlp.
80
74
81
75
### Featured Plugins
82
76
77
+
> [!NOTE]
78
+
> These plugins are not affiliated with yt-dlp
79
+
83
80
-[bgutil-ytdlp-pot-provider](https://github.com/Brainicism/bgutil-ytdlp-pot-provider) by [Brainicism](https://github.com/Brainicism)
84
-
- A PO Token Provider which uses [BgUtils](https://github.com/LuanRT/BgUtils) to generate PO Tokens. _Not affiliated with yt-dlp._
81
+
- A PO Token Provider which uses [BgUtils](https://github.com/LuanRT/BgUtils) to generate PO Tokens. _Maintained by a yt-dlp maintainer_
82
+
-[yt-dlp-getpot-wpc](https://github.com/coletdjnz/yt-dlp-getpot-wpc) by [coletdjnz](https://github.com/coletdjnz)
83
+
- A PO Token Provider which uses YouTube in the browser to generate PO Tokens. Useful as a fallback/alternative if the above fails. _Maintained by a yt-dlp core maintainer_
85
84
86
85
Check out the [yt-dlp-pot-provider GitHub topic](https://github.com/topics/yt-dlp-pot-provider) for more PO Token Provider plugins.
87
86
88
87
For developers, refer to the [PO Token Provider developer documentation](https://github.com/yt-dlp/yt-dlp/tree/master/yt_dlp/extractor/youtube/pot/README.md)
89
88
90
-
## Guide: Providing a PO Token manually (for use with `mweb` client)
91
-
92
-
This section provides a basic guide on extracting PO Token(s) manually from YouTube in a web browser **for use with the `mweb` client**, and manually passing it to yt-dlp via the [`po_token` extractor argument](https://github.com/yt-dlp/yt-dlp#youtube).
93
-
The same PO Token extraction method _may_ work with other web browser-based clients too.
94
-
95
-
> [!TIP]
96
-
> When supplying multiple PO Tokens, use the same extractor args option and comma-separate the PO Token configurations. For example:
The PO Token used for `web` GVS requests is tied to your YouTube session, so you will need to provide cookies.
103
-
104
-
1. Open **[YouTube Music](https://music.youtube.com)** in a browser.
105
-
2. Open the developer console (F12), then go to the "Network" tab (click the `>>` button if you don't see it)
106
-
3. Filter requests by `v1/player`
107
-
4. Play a video - a `player` request should appear in the network tab
108
-
5. From the most recent `player` request, extract the PO Token from `serviceIntegrityDimensions.poToken` field in the JSON request body
109
-
6. Pass the PO Token for GVS to yt-dlp using `--extractor-args "youtube:player-client=default,mweb;po_token=mweb.gvs+PO_TOKEN_VALUE_HERE"` with cookies (`--cookies COOKIES_FILE` or `--cookies-from-browser`)
110
-
111
-
If using an account, [refer to this guide on exporting account cookies](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#exporting-youtube-cookies)
112
-
113
-
(Not recommended) If not using an account, you may also provide visitor data instead of cookies. Refer to [Passing Visitor Data without cookies](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#passing-visitor-data-without-cookies).
114
-
115
-
### PO Token for Player or Subs
116
-
117
-
The PO Token for `web`/`mweb` Player or Subs requests is tied to the Video ID. This means you must generate a new PO Token for each video.
118
-
119
-
1. Open **[YouTube Web](https://www.youtube.com)** in a browser.
120
-
2. Open the developer console (F12), then go to the "Network" tab and filter by `v1/player`
121
-
3. Navigate to the video you want to download (e.g. using search - do not go to the video url directly as the page will refresh)
122
-
4. In the request payload JSON, find the PO Token at `serviceIntegrityDimensions.poToken` and save that value
123
-
5. Export cookies from the browser
124
-
125
-
**For Subs PO Token:**
126
-
- Pass the PO Token for Subs to yt-dlp using `--extractor-args "youtube:po_token=web.subs+PO_TOKEN_VALUE_HERE"`
127
-
128
-
**For Player PO Token:**
129
-
> [!NOTE]
130
-
> If you are using the `web` client and have not disabled the `webpage` request, providing this PO Token is not necessary at this time.
131
-
132
-
- Pass the PO Token for Player to yt-dlp using `--extractor-args "youtube:player-client=default,mweb;po_token=mweb.player+PO_TOKEN_VALUE_HERE"`
133
-
134
-
135
89
## Other PO Token related tools
136
90
137
91
-[BgUtils](https://github.com/LuanRT/BgUtils) by [LuanRT](https://github.com/LuanRT)
@@ -145,24 +99,8 @@ PO Tokens are still an active area of research, and at the same time YouTube is
145
99
146
100
A PO Token is generated by either BotGuard (Web), DroidGuard (Android), iOSGuard (iOS). A PO Token from one platform cannot be used on another (i.e., Web PO Token cannot be used on Android or iOS).
147
101
148
-
If you are interested, we recommend checking out the [BgUtils](https://github.com/LuanRT/BgUtils) project which does a deeper dive into the BotGuard attestation process.
149
-
150
-
### PO Tokens for GVS
102
+
PO Tokens have a "content binding", meaning they are bound to the user session (Visitor ID or account Session ID) or to the video ID. Most PO Tokens (such as for `web` GVS/Player) are bound to the video ID, so a new token is required for each video.
151
103
152
-
GVS uses a PO token bound to the user session.
104
+
These PO Tokens have a limited lifespan (possibly as short as 12 hours), so they will need to be refreshed periodically. However, some reports suggest that the token may be valid for several months.
153
105
154
-
For Web session tokens:
155
-
- When logged out, are bound to a Visitor ID. This Visitor ID is found in the `VISITOR_INFO1_LIVE` cookie, in the `visitorData` value which is sent with Innertube API requests, or with `ytcfg.get('VISITOR_DATA')` in the browser console.
156
-
- When logged in, are bound to the account Session ID (first part of the Data Sync ID). This can be found at `responseContext.mainAppWebResponseContext.dataSyncId` in Innertube responses, or with `ytcfg.get('DATASYNC_ID')` in the browser console.
157
-
158
-
If a video download fails with an HTTP 403 midway through, then the client likely requires a PO Token for GVS.
159
-
160
-
These PO Tokens are only valid for a limited time (usually at least 12 hours), so it will need to be refreshed periodically. However, some reports suggest that the token may be valid for many days.
161
-
162
-
### PO Tokens for Player and Subs
163
-
164
-
Web Tokens for player (and subtitles) requests are bound to the video ID the associated `/player` request is for. YouTube has only recently started generating these for some clients (e.g. `web`).
165
-
166
-
As of writing, some clients, such as `web_music` use a session-bound PO Token for player requests. This is likely to change.
167
-
168
-
For Android (and presumably iOS), the Player PO Token is bound to the user session, similar to GVS tokens. If a Player PO token is provided, the GVS PO token is not required.
106
+
If you are interested, we recommend checking out the [BgUtils](https://github.com/LuanRT/BgUtils) project which does a deeper dive into the BotGuard attestation process.
0 commit comments