Interface PoTokenProvider
-
public interface PoTokenProviderInterface to providepoTokens to YouTube player requests.On some major clients, YouTube requires that the integrity of the device passes some checks to allow playback.
These checks involve running codes to verify the integrity and using their result to generate one or multiple
poToken(s) (which stands for proof of origin token(s)).These tokens may have a role in triggering the sign in requirement.
If an implementation does not want to return a
poTokenfor a specific client, it must returnnull.Implementations of this interface are expected to be thread-safe, as they may be accessed by multiple threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PoTokenResultgetAndroidClientPoToken(java.lang.String videoId)Get aPoTokenResultspecific to the Android app, a.k.a.PoTokenResultgetIosClientPoToken(java.lang.String videoId)Get aPoTokenResultspecific to the iOS app, a.k.a.PoTokenResultgetWebClientPoToken(java.lang.String videoId)Get aPoTokenResultspecific to the desktop website, a.k.a.PoTokenResultgetWebEmbedClientPoToken(java.lang.String videoId)Get aPoTokenResultspecific to the web embeds, a.k.a.
-
-
-
Method Detail
-
getWebClientPoToken
@Nullable PoTokenResult getWebClientPoToken(java.lang.String videoId)
Get aPoTokenResultspecific to the desktop website, a.k.a. the WEB InnerTube client.To be generated and valid,
poTokens from this client must be generated using Google's BotGuard machine, which requires a JavaScript engine with a good DOM implementation. They must be added to adaptive/DASH streaming URLs with thepotparameter.Note that YouTube desktop website generates two
poTokens: - one for the player requestspoTokens, using the videoId as the minter value; - one for the streaming URLs, using a visitor data for logged-out users as the minter value.- Returns:
- a
PoTokenResultspecific to the WEB InnerTube client
-
getWebEmbedClientPoToken
@Nullable PoTokenResult getWebEmbedClientPoToken(java.lang.String videoId)
Get aPoTokenResultspecific to the web embeds, a.k.a. the WEB_EMBEDDED_PLAYER InnerTube client.To be generated and valid,
poTokens from this client must be generated using Google's BotGuard machine, which requires a JavaScript engine with a good DOM implementation. They should be added to adaptive/DASH streaming URLs with thepotparameter.As of writing, like the YouTube desktop website previously did, it generates only one
poToken, sent in player requests and streaming URLs, using a visitor data for logged-out users.poTokens do not seem to be mandatory for now on this client.- Returns:
- a
PoTokenResultspecific to the WEB_EMBEDDED_PLAYER InnerTube client
-
getAndroidClientPoToken
@Nullable PoTokenResult getAndroidClientPoToken(java.lang.String videoId)
Get aPoTokenResultspecific to the Android app, a.k.a. the ANDROID InnerTube client.Implementation details are not known, the app uses DroidGuard, a downloaded native virtual machine ran by Google Play Services for which its code is updated pretty frequently.
As of writing, DroidGuard seem to check for the Android app signature and package ID, as non-rooted YouTube patched with reVanced doesn't work without spoofing another InnerTube client while the rooted version works without any client spoofing.
There should be only one
poTokenneeded for the player requests, it shouldn't be required for regular adaptive URLs (i.e. not server adaptive bitrate (SABR) URLs). HLS formats returned (only for premieres and running and post-live livestreams) in the client's HLS manifest URL should work withoutpoTokens.- Returns:
- a
PoTokenResultspecific to the ANDROID InnerTube client
-
getIosClientPoToken
@Nullable PoTokenResult getIosClientPoToken(java.lang.String videoId)
Get aPoTokenResultspecific to the iOS app, a.k.a. the IOS InnerTube client.Implementation details are not known, the app seem to use something called iosGuard which should be similar to Android's DroidGuard. It may rely on Apple's attestation APIs.
As of writing, there should be only one
poTokenneeded for the player requests, it shouldn't be required for regular adaptive URLs (i.e. not server adaptive bitrate (SABR) URLs). HLS formats returned in the client's HLS manifest URL should also work without apoToken.- Returns:
- a
PoTokenResultspecific to the IOS InnerTube client
-
-