diff --git a/src/core/endpoints/PlayerEndpoint.ts b/src/core/endpoints/PlayerEndpoint.ts index b43312648..7bab7a49a 100644 --- a/src/core/endpoints/PlayerEndpoint.ts +++ b/src/core/endpoints/PlayerEndpoint.ts @@ -8,6 +8,11 @@ export const PATH = '/player'; * @returns The payload. */ export function build(opts: PlayerEndpointOptions): IPlayerRequest { + const is_android = + opts.client === 'ANDROID' || + opts.client === 'YTMUSIC_ANDROID' || + opts.client === 'YTSTUDIO_ANDROID'; + return { playbackContext: { contentPlaybackContext: { @@ -33,7 +38,9 @@ export function build(opts: PlayerEndpointOptions): IPlayerRequest { videoId: opts.video_id, ...{ client: opts.client, - playlistId: opts.playlist_id + playlistId: opts.playlist_id, + // Workaround streaming URLs returning 403 when using Android clients. + params: is_android ? '8AEB' : opts.params } }; } \ No newline at end of file diff --git a/src/types/Endpoints.ts b/src/types/Endpoints.ts index ef31d1878..bd1a6e4c9 100644 --- a/src/types/Endpoints.ts +++ b/src/types/Endpoints.ts @@ -23,8 +23,9 @@ export interface IPlayerRequest { videoId: string; racyCheckOk: boolean; contentCheckOk: boolean; - client?: InnerTubeClient; playlistId?: string; + params?: string; + client?: InnerTubeClient; } export type PlayerEndpointOptions = { @@ -44,6 +45,10 @@ export type PlayerEndpointOptions = { * The playlist ID. */ playlist_id?: string; + /** + * Additional protobuf parameters. + */ + params?: string; } export type NextEndpointOptions = {