UNPKG

@np-dev/youtubei-js

Version:

A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).

28 lines 1.39 kB
export const PATH = '/player'; /** * Builds a `/player` request payload. * @param opts - The options to use. * @returns The payload. */ export function build(opts) { const is_android = opts.client === 'ANDROID' || opts.client === 'YTMUSIC_ANDROID' || opts.client === 'YTSTUDIO_ANDROID'; return Object.assign({ playbackContext: { contentPlaybackContext: Object.assign({ vis: 0, splay: false, referer: opts.playlist_id ? `https://www.youtube.com/watch?v=${opts.video_id}&list=${opts.playlist_id}` : `https://www.youtube.com/watch?v=${opts.video_id}`, currentUrl: opts.playlist_id ? `/watch?v=${opts.video_id}&list=${opts.playlist_id}` : `/watch?v=${opts.video_id}`, autonavState: 'STATE_ON', autoCaptionsDefaultOn: false, html5Preference: 'HTML5_PREF_WANTS', lactMilliseconds: '-1' }, { signatureTimestamp: opts.sts }) }, attestationRequest: { omitBotguardData: true }, racyCheckOk: true, contentCheckOk: true, videoId: opts.video_id }, { client: opts.client, playlistId: opts.playlist_id, // Workaround streaming URLs returning 403 or getting throttled when using Android based clients. params: is_android ? '2AMBCgIQBg' : opts.params }); } //# sourceMappingURL=PlayerEndpoint.js.map