diff --git a/README.md b/README.md index aecc1f12..af313656 100644 --- a/README.md +++ b/README.md @@ -292,7 +292,7 @@ Retrieves video info, including playback data and even layout elements such as m | Param | Type | Description | | --- | --- | --- | | video_id | `string` | The id of the video | -| client? | `InnerTubeClient` | `WEB`, `ANDROID` or `YTMUSIC` | +| client? | `InnerTubeClient` | `WEB`, `ANDROID`, `YTMUSIC`, `YTMUSIC_ANDROID` or `TV_EMBEDDED` |
Methods & Getters @@ -347,7 +347,7 @@ Suitable for cases where you only need basic video metadata. Also, it is faster | Param | Type | Description | | --- | --- | --- | | video_id | `string` | The id of the video | -| client? | `InnerTubeClient` | `WEB`, `ANDROID` or `YTMUSIC` | +| client? | `InnerTubeClient` | `WEB`, `ANDROID`, `YTMUSIC_ANDROID`, `YTMUSIC`, `TV_EMBEDDED` | ### search(query, filters?) @@ -569,7 +569,7 @@ For example, you may want to call an endpoint directly, that can be achieved wit const payload = { videoId: 'jLTOuvBTLxA', - client: 'YTMUSIC', // InnerTube client, can be ANDROID, YTMUSIC, WEB + client: 'YTMUSIC', // InnerTube client, can be ANDROID, YTMUSIC, YTMUSIC_ANDROID, WEB or TV_EMBEDDED parse: true // tells YouTube.js to parse the response, this is not sent to InnerTube. }; diff --git a/src/Innertube.ts b/src/Innertube.ts index 89f03dd2..62c0ce76 100644 --- a/src/Innertube.ts +++ b/src/Innertube.ts @@ -48,7 +48,7 @@ export interface SearchFilters { sort_by?: 'relevance' | 'rating' | 'upload_date' | 'view_count'; } -export type InnerTubeClient = 'ANDROID' | 'YTMUSIC_ANDROID' | 'WEB' | 'YTMUSIC'; +export type InnerTubeClient = 'WEB' | 'ANDROID' | 'YTMUSIC_ANDROID' | 'YTMUSIC' | 'TV_EMBEDDED'; class Innertube { session; diff --git a/src/core/Session.ts b/src/core/Session.ts index cad0ee47..f57b38a0 100644 --- a/src/core/Session.ts +++ b/src/core/Session.ts @@ -25,6 +25,7 @@ export interface Context { userAgent: string; clientName: string; clientVersion: string; + clientScreen?: string, androidSdkVersion?: string; osName: string; osVersion: string; diff --git a/src/parser/youtube/VideoInfo.ts b/src/parser/youtube/VideoInfo.ts index 82b845f6..6f8065ad 100644 --- a/src/parser/youtube/VideoInfo.ts +++ b/src/parser/youtube/VideoInfo.ts @@ -46,9 +46,9 @@ export interface FormatOptions { */ format?: string; /** - * InnerTube client, can be ANDROID, WEB or YTMUSIC + * InnerTube client, can be ANDROID, WEB, YTMUSIC, YTMUSIC_ANDROID or TV_EMBEDDED */ - client?: 'ANDROID' | 'WEB' | 'YTMUSIC' + client?: 'ANDROID' | 'WEB' | 'YTMUSIC' | 'YTMUSIC_ANDROID' | 'TV_EMBEDDED' } export interface DownloadOptions extends FormatOptions { diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 83c93324..859a3efa 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -49,6 +49,10 @@ export const CLIENTS = Object.freeze({ YTMUSIC_ANDROID: { NAME: 'ANDROID_MUSIC', VERSION: '5.17.51' + }, + TV_EMBEDDED: { + NAME: 'TVHTML5_SIMPLY_EMBEDDED_PLAYER', + VERSION: '2.0' } }); export const STREAM_HEADERS = Object.freeze({ diff --git a/src/utils/HTTPClient.ts b/src/utils/HTTPClient.ts index 3c26f0c6..669388bb 100644 --- a/src/utils/HTTPClient.ts +++ b/src/utils/HTTPClient.ts @@ -143,6 +143,11 @@ export default class HTTPClient { ctx.client.clientName = Constants.CLIENTS.YTMUSIC_ANDROID.NAME; ctx.client.androidSdkVersion = Constants.CLIENTS.ANDROID.SDK_VERSION; break; + case 'TV_EMBEDDED': + ctx.client.clientVersion = Constants.CLIENTS.TV_EMBEDDED.VERSION; + ctx.client.clientName = Constants.CLIENTS.TV_EMBEDDED.NAME; + ctx.client.clientScreen = 'EMBED'; + break; default: break; }