mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
feat: Add WEB_EMBEDDED client (#756)
This commit is contained in:
@@ -155,6 +155,9 @@ export default class Player {
|
||||
case 'TVHTML5_SIMPLY_EMBEDDED_PLAYER':
|
||||
url_components.searchParams.set('cver', Constants.CLIENTS.TV_EMBEDDED.VERSION);
|
||||
break;
|
||||
case 'WEB_EMBEDDED_PLAYER':
|
||||
url_components.searchParams.set('cver', Constants.CLIENTS.WEB_EMBEDDED.VERSION);
|
||||
break;
|
||||
}
|
||||
|
||||
const result = url_components.toString();
|
||||
|
||||
@@ -21,7 +21,8 @@ export enum ClientType {
|
||||
ANDROID = 'ANDROID',
|
||||
ANDROID_MUSIC = 'ANDROID_MUSIC',
|
||||
ANDROID_CREATOR = 'ANDROID_CREATOR',
|
||||
TV_EMBEDDED = 'TVHTML5_SIMPLY_EMBEDDED_PLAYER'
|
||||
TV_EMBEDDED = 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
|
||||
WEB_EMBEDDED = 'WEB_EMBEDDED_PLAYER'
|
||||
}
|
||||
|
||||
export type Context = {
|
||||
|
||||
@@ -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';
|
||||
export type InnerTubeClient = 'IOS' | 'WEB' | 'ANDROID' | 'YTMUSIC' | 'YTMUSIC_ANDROID' | 'YTSTUDIO_ANDROID' | 'TV_EMBEDDED' | 'YTKIDS' | 'WEB_EMBEDDED';
|
||||
|
||||
export type UploadDate = 'all' | 'hour' | 'today' | 'week' | 'month' | 'year';
|
||||
export type SearchType = 'all' | 'video' | 'channel' | 'playlist' | 'movie';
|
||||
|
||||
@@ -13,7 +13,8 @@ export const URLS = Object.freeze({
|
||||
TEST: 'https://test-youtubei.sandbox.googleapis.com/youtubei/',
|
||||
CAMI: 'http://cami-youtubei.sandbox.googleapis.com/youtubei/',
|
||||
UYTFE: 'https://uytfe.sandbox.google.com/youtubei/'
|
||||
})
|
||||
}),
|
||||
GOOGLE_SEARCH_BASE: 'https://www.google.com/'
|
||||
});
|
||||
export const OAUTH = Object.freeze({
|
||||
REGEX: Object.freeze({
|
||||
@@ -68,6 +69,14 @@ export const CLIENTS = Object.freeze({
|
||||
NAME_ID: '85',
|
||||
NAME: 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
|
||||
VERSION: '2.0'
|
||||
},
|
||||
WEB_EMBEDDED: {
|
||||
NAME_ID: '56',
|
||||
NAME: 'WEB_EMBEDDED_PLAYER',
|
||||
VERSION: '2.20240111.09.00',
|
||||
API_KEY: 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8',
|
||||
API_VERSION: 'v1',
|
||||
STATIC_VISITOR_ID: '6zpwvWUNAco'
|
||||
}
|
||||
});
|
||||
export const STREAM_HEADERS = Object.freeze({
|
||||
@@ -82,4 +91,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' ];
|
||||
export const SUPPORTED_CLIENTS = [ 'IOS', 'WEB', 'YTKIDS', 'YTMUSIC', 'ANDROID', 'YTSTUDIO_ANDROID', 'YTMUSIC_ANDROID', 'TV_EMBEDDED', 'WEB_EMBEDDED' ];
|
||||
|
||||
@@ -257,6 +257,12 @@ export default class HTTPClient {
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'WEB_EMBEDDED':
|
||||
ctx.client.clientName = Constants.CLIENTS.WEB_EMBEDDED.NAME;
|
||||
ctx.client.clientVersion = Constants.CLIENTS.WEB_EMBEDDED.VERSION;
|
||||
ctx.client.clientScreen = 'EMBED';
|
||||
ctx.thirdParty = { embedUrl: Constants.URLS.GOOGLE_SEARCH_BASE };
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user