Skip to content

Commit 388881c

Browse files
authored
[Extractor] Update manual PO Token extraction guide (#60)
authored by: coletdjnz
1 parent 7329d99 commit 388881c

File tree

1 file changed

+36
-42
lines changed

1 file changed

+36
-42
lines changed

PO Token Guide.md

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ For more technical details on these tokens, refer to the [technical details sect
3939

4040
## Cases where a PO Token is required
4141

42-
There are currently two cases yt-dlp may require PO Tokens for video downloads, [depending on the client used](#current-po-token-enforcement):
43-
- GVS: Google Video Server requests
44-
- Player: Innertube `player` requests
42+
There are currently three cases yt-dlp may require PO Tokens for video downloads, [depending on the client used](#current-po-token-enforcement):
43+
- GVS: Google Video Server requests (video streaming - https, dash, hls, etc.)
44+
- Player: Innertube `player` requests (fetch video format URLs)
4545
- Subs: Subtitle requests
4646

4747
The PO Tokens may be generated differently for each of these cases, depending on the client.
@@ -50,26 +50,32 @@ The PO Tokens may be generated differently for each of these cases, depending on
5050

5151
YouTube is at present rolling out changes to enforce PO Tokens for video playback. Currently, only GVS and Subs require PO Tokens for some clients.
5252

53-
| Client | PO Token for GVS Required | PO Token for Player Required | PO Token for Subs required | Notes |
54-
|----------------|---------------------------|------------------------------|----------------------------|--------------------------------------------------|
55-
| `web` | Yes | No | Sometimes (A/B test) | Only SABR formats available |
56-
| `web_safari` | Yes* | No | Sometimes (A/B test) | |
57-
| `mweb` | Yes | No | No | |
58-
| `tv` | No | No | No | All formats may have DRM if you request too much |
59-
| `tv_embedded` | No | No | No | Requires account cookies |
60-
| `web_embedded` | No | No | No | Only embeddable videos available |
61-
| `web_music` | Yes | No | No | |
62-
| `web_creator` | Yes | No | No | Requires account cookies |
63-
| `android` | Yes? | ? | No | Account cookies not supported |
64-
| `android_vr` | No | No | No | YouTube Kids videos are not available |
65-
| `ios` | Yes?* | ? | No | Account cookies not supported |
66-
67-
*Client provides HLS (m3u8) formats which do not require PO Token for GVS at this time.
53+
| Client | PO Token Required For | Notes |
54+
|----------------|-----------------------------|-------------------------------------------------------------------------------------------------|
55+
| `web` | Subs (rolling out), GVS | Only SABR formats available |
56+
| `web_safari` | Subs (rolling out), GVS* | Same as `web`. *Provides HLS (m3u8) formats which do not require PO Token for GVS at this time. |
57+
| `mweb` | GVS | |
58+
| `tv` | Not required | All formats may have DRM if you request too much |
59+
| `tv_simply` | Not required | Account cookies not supported |
60+
| `tv_embedded` | Not required | Requires account cookies |
61+
| `web_embedded` | Not required | Only embeddable videos available |
62+
| `web_music` | GVS | |
63+
| `web_creator` | GVS | Requires account cookies |
64+
| `android` | GVS or Player | Account cookies not supported |
65+
| `android_vr` | Not required | YouTube Kids videos are not available |
66+
| `ios` | GVS or Player (rolling out) | Account cookies not supported |
67+
68+
For all clients:
69+
- GVS PO Token is not required for YouTube Premium subscribers
70+
- HLS live streams do not require a PO Token (excluding `ios` client)
6871

6972
You can select what client to use with the [`player_client` extractor argument](https://github.com/yt-dlp/yt-dlp#youtube).
7073

7174
## PO Token Provider Plugins
7275

76+
> [!TIP]
77+
> Recommended
78+
7379
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.
7480

7581
### Featured Plugins
@@ -93,38 +99,24 @@ The same PO Token extraction method _may_ work with other web browser-based clie
9399

94100
### PO Token for GVS
95101

96-
The PO Token used for `web` GVS requests is tied to your YouTube session. It generated differently depending on if you are logged in to yt-dlp or not.
97-
98-
#### No account
99-
100-
1. Open [YouTube Music](https://music.youtube.com) or YouTube Embedded (e.g. https://www.youtube.com/embed/aqz-KE-bpKQ) in a browser. **Make sure you are not logged in to any account!**
101-
2. Open any video
102-
3. Open the developer console (F12), then go to the "Network" tab (click the `>>` button if you don't see it)
103-
4. Filter requests by `googlevideo.com`
104-
5. Click the video and play for a few seconds - requests to `googlevideo.com` should appear in the network tab
105-
6. From the most recent `googlevideo.com` request, extract the `pot` query parameter value from the URL
106-
7. 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`)
102+
The PO Token used for `web` GVS requests is tied to your YouTube session, so you will need to provide cookies.
107103

108-
Although not recommended, 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).
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`)
109110

110-
#### With an account
111-
112-
1. Open [YouTube Music](https://music.youtube.com) in a browser, and log in with the user you are using with yt-dlp
113-
2. Open any video
114-
3. Follow steps 3-6 above
115-
4. 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 your account cookies ](https://github.com/yt-dlp/yt-dlp/wiki/Extractors#exporting-youtube-cookies)
116-
117-
Addendum:
118-
- If there is no `pot` parameter in the `googlevideo.com` URL, wait a few seconds for more requests to be made and check them.
119-
- If there is a `sabr=1` query parameter in the `googlevideo.com` URL, then the PO Token is in the request body protobuf (and therefore is not easy to extract).
120-
- This should not be the case for YouTube Music or YouTube Embedded - if so, please raise an issue, so we can update these docs.
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)
121112

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).
122114

123115
### PO Token for Player or Subs
124116

125117
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.
126118

127-
1. Open [YouTube Web](https://www.youtube.com) in a browser.
119+
1. Open **[YouTube Web](https://www.youtube.com)** in a browser.
128120
2. Open the developer console (F12), then go to the "Network" tab and filter by `v1/player`
129121
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)
130122
4. In the request payload JSON, find the PO Token at `serviceIntegrityDimensions.poToken` and save that value
@@ -172,3 +164,5 @@ These PO Tokens are only valid for a limited time (usually at least 12 hours), s
172164
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`).
173165

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

0 commit comments

Comments
 (0)