fix(android): workaround streaming URLs returning 403 (#390)

This commit is contained in:
LuanRT
2023-04-28 22:02:45 -03:00
committed by GitHub
parent 95e0294eab
commit 75ea09dde8
2 changed files with 14 additions and 2 deletions

View File

@@ -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
}
};
}

View File

@@ -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 = {