Skip to content

Commit

Permalink
feat: Add WEB_CREATOR client (#757)
Browse files Browse the repository at this point in the history
* feat: Add WEB_CREATOR client

* update to latest version WEB_CREATOR iv-org/invidious#4928 (comment)
  • Loading branch information
unixfox authored Sep 20, 2024
1 parent 00dd409 commit dd7f5cf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export enum ClientType {
ANDROID_MUSIC = 'ANDROID_MUSIC',
ANDROID_CREATOR = 'ANDROID_CREATOR',
TV_EMBEDDED = 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
WEB_EMBEDDED = 'WEB_EMBEDDED_PLAYER'
WEB_EMBEDDED = 'WEB_EMBEDDED_PLAYER',
WEB_CREATOR = 'WEB_CREATOR'
}

export type Context = {
Expand Down
2 changes: 1 addition & 1 deletion src/types/Misc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SessionOptions } from '../core/index.js';

export type InnerTubeConfig = SessionOptions;
export type InnerTubeClient = 'IOS' | 'WEB' | 'ANDROID' | 'YTMUSIC' | 'YTMUSIC_ANDROID' | 'YTSTUDIO_ANDROID' | 'TV_EMBEDDED' | 'YTKIDS' | 'WEB_EMBEDDED';
export type InnerTubeClient = 'IOS' | 'WEB' | 'ANDROID' | 'YTMUSIC' | 'YTMUSIC_ANDROID' | 'YTSTUDIO_ANDROID' | 'TV_EMBEDDED' | 'YTKIDS' | 'WEB_EMBEDDED' | 'WEB_CREATOR';

export type UploadDate = 'all' | 'hour' | 'today' | 'week' | 'month' | 'year';
export type SearchType = 'all' | 'video' | 'channel' | 'playlist' | 'movie';
Expand Down
10 changes: 9 additions & 1 deletion src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export const CLIENTS = Object.freeze({
API_KEY: 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8',
API_VERSION: 'v1',
STATIC_VISITOR_ID: '6zpwvWUNAco'
},
WEB_CREATOR: {
NAME_ID: '62',
NAME: 'WEB_CREATOR',
VERSION: '1.20240918.03.00',
API_KEY: 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8',
API_VERSION: 'v1',
STATIC_VISITOR_ID: '6zpwvWUNAco'
}
});
export const STREAM_HEADERS = Object.freeze({
Expand All @@ -91,4 +99,4 @@ export const INNERTUBE_HEADERS_BASE = Object.freeze({
'content-type': 'application/json'
});

export const SUPPORTED_CLIENTS = [ 'IOS', 'WEB', 'YTKIDS', 'YTMUSIC', 'ANDROID', 'YTSTUDIO_ANDROID', 'YTMUSIC_ANDROID', 'TV_EMBEDDED', 'WEB_EMBEDDED' ];
export const SUPPORTED_CLIENTS = [ 'IOS', 'WEB', 'YTKIDS', 'YTMUSIC', 'ANDROID', 'YTSTUDIO_ANDROID', 'YTMUSIC_ANDROID', 'TV_EMBEDDED', 'WEB_EMBEDDED', 'WEB_CREATOR' ];
4 changes: 4 additions & 0 deletions src/utils/HTTPClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ export default class HTTPClient {
ctx.client.clientScreen = 'EMBED';
ctx.thirdParty = { embedUrl: Constants.URLS.GOOGLE_SEARCH_BASE };
break;
case 'WEB_CREATOR':
ctx.client.clientName = Constants.CLIENTS.WEB_CREATOR.NAME;
ctx.client.clientVersion = Constants.CLIENTS.WEB_CREATOR.VERSION;
break;
default:
break;
}
Expand Down

0 comments on commit dd7f5cf

Please sign in to comment.