diff --git a/examples/auth/custom-oauth2-creds/index.ts b/examples/auth/custom-oauth2-creds/index.ts index 43c59be4a..e4b844991 100644 --- a/examples/auth/custom-oauth2-creds/index.ts +++ b/examples/auth/custom-oauth2-creds/index.ts @@ -46,8 +46,10 @@ app.get('/', async (_req, res) => { console.info('Innertube instance is logged in.'); const userInfo = await innertube.account.getInfo(); + + console.log(await innertube.getBasicInfo('R8vgwMYSQi8', 'ANDROID')); - return res.send({ userInfo }); + return res.send({ userInfo }); } if (!oAuth2Client) { diff --git a/src/core/Player.ts b/src/core/Player.ts index 802ad2ae6..b5cfac317 100644 --- a/src/core/Player.ts +++ b/src/core/Player.ts @@ -140,6 +140,9 @@ export default class Player { case 'WEB': url_components.searchParams.set('cver', Constants.CLIENTS.WEB.VERSION); break; + case 'MWEB': + url_components.searchParams.set('cver', Constants.CLIENTS.MWEB.VERSION); + break; case 'WEB_REMIX': url_components.searchParams.set('cver', Constants.CLIENTS.YTMUSIC.VERSION); break; diff --git a/src/core/Session.ts b/src/core/Session.ts index 69e1746f9..4d69a3e9a 100644 --- a/src/core/Session.ts +++ b/src/core/Session.ts @@ -15,6 +15,7 @@ import type { OAuth2Tokens, OAuth2AuthErrorEventHandler, OAuth2AuthPendingEventH export enum ClientType { WEB = 'WEB', + MWEB = 'MWEB', KIDS = 'WEB_KIDS', MUSIC = 'WEB_REMIX', IOS = 'iOS', diff --git a/src/types/Misc.ts b/src/types/Misc.ts index ba6012cf9..f6943b39d 100644 --- a/src/types/Misc.ts +++ b/src/types/Misc.ts @@ -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' | 'TV_EMBEDDED' | 'YTKIDS' | 'WEB_EMBEDDED' | 'WEB_CREATOR'; +export type InnerTubeClient = 'IOS' | 'WEB' | 'MWEB' | 'ANDROID' | 'YTMUSIC' | 'YTMUSIC_ANDROID' | 'YTSTUDIO_ANDROID' | 'TV' | 'TV_EMBEDDED' | 'YTKIDS' | 'WEB_EMBEDDED' | 'WEB_CREATOR'; export type UploadDate = 'all' | 'hour' | 'today' | 'week' | 'month' | 'year'; export type SearchType = 'all' | 'video' | 'channel' | 'playlist' | 'movie'; diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 07ffbf3b7..4b9d7109d 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -38,6 +38,12 @@ export const CLIENTS = Object.freeze({ API_VERSION: 'v1', STATIC_VISITOR_ID: '6zpwvWUNAco' }, + MWEB: { + NAME_ID: '2', + NAME: 'MWEB', + VERSION: '2.20241205.01.00', + API_VERSION: 'v1' + }, WEB_KIDS: { NAME_ID: '76', NAME: 'WEB_KIDS', @@ -105,4 +111,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', 'TV_EMBEDDED', 'WEB_EMBEDDED', 'WEB_CREATOR' ]; \ No newline at end of file +export const SUPPORTED_CLIENTS = [ 'IOS', 'WEB', 'MWEB', 'YTKIDS', 'YTMUSIC', 'ANDROID', 'YTSTUDIO_ANDROID', 'YTMUSIC_ANDROID', 'TV', 'TV_EMBEDDED', 'WEB_EMBEDDED', 'WEB_CREATOR' ]; \ No newline at end of file diff --git a/src/utils/HTTPClient.ts b/src/utils/HTTPClient.ts index 38db55e76..18762f3b3 100644 --- a/src/utils/HTTPClient.ts +++ b/src/utils/HTTPClient.ts @@ -190,6 +190,12 @@ export default class HTTPClient { } switch (client.toUpperCase()) { + case 'MWEB': + ctx.client.clientVersion = Constants.CLIENTS.MWEB.VERSION; + ctx.client.clientName = Constants.CLIENTS.MWEB.NAME; + ctx.client.clientFormFactor = 'SMALL_FORM_FACTOR'; + ctx.client.platform = 'MOBILE'; + break; case 'IOS': ctx.client.deviceMake = 'Apple'; ctx.client.deviceModel = Constants.CLIENTS.IOS.DEVICE_MODEL;