mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-27 08:39:23 +00:00
fix(android): workaround streaming URLs returning 403 (#390)
This commit is contained in:
@@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user