Skip to content

Commit

Permalink
first try
Browse files Browse the repository at this point in the history
  • Loading branch information
unixfox committed Jul 27, 2024
1 parent bd9f6ac commit 6a13133
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/core/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export type SessionOptions = {
* Fetch function to use.
*/
fetch?: FetchFunction;
/**
* Token for serviceIntegrityDimensions
*/
po_token?: string;
}

export type SessionData = {
Expand Down Expand Up @@ -213,8 +217,9 @@ export default class Session extends EventEmitter {
key: string;
api_version: string;
account_index: number;
po_token?: string;

constructor(context: Context, api_key: string, api_version: string, account_index: number, player?: Player, cookie?: string, fetch?: FetchFunction, cache?: ICache) {
constructor(context: Context, api_key: string, api_version: string, account_index: number, player?: Player, cookie?: string, fetch?: FetchFunction, cache?: ICache, po_token?: string) {
super();
this.http = new HTTPClient(this, cookie, fetch);
this.actions = new Actions(this);
Expand All @@ -226,6 +231,7 @@ export default class Session extends EventEmitter {
this.api_version = api_version;
this.context = context;
this.player = player;
this.po_token = po_token;
}

on(type: 'auth', listener: OAuth2AuthEventHandler): void;
Expand Down
7 changes: 5 additions & 2 deletions src/core/endpoints/PlayerEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export function build(opts: PlayerEndpointOptions): IPlayerRequest {
...{
client: opts.client,
playlistId: opts.playlist_id,
params: opts.params
}
params: opts.params,
serviceIntegrityDimensions: {
poToken: session.po_token.toString(),
},
},
};
}
7 changes: 7 additions & 0 deletions src/types/Endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export interface IPlayerRequest {
playlistId?: string;
params?: string;
client?: InnerTubeClient;
serviceIntegrityDimensions?: {
poToken: string
}
}

export type PlayerEndpointOptions = {
Expand All @@ -52,6 +55,10 @@ export type PlayerEndpointOptions = {
* Additional protobuf parameters.
*/
params?: string;
/**
* Token for serviceIntegrityDimensions
*/
po_token?: string;
}

export type NextEndpointOptions = {
Expand Down

0 comments on commit 6a13133

Please sign in to comment.