mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-13 17:42:18 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeff0c3fdc | ||
|
|
00d67ed417 | ||
|
|
78f93c7118 | ||
|
|
6db3f0ad91 | ||
|
|
cf48385f72 |
@@ -54,7 +54,7 @@ module.exports = {
|
||||
'content-type': 'application/json',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
'x-goog-authuser': 0,
|
||||
'x-goog-visitor-id': info.session.context.client.visitorData,
|
||||
'x-goog-visitor-id': info.session.context.client.visitorData || '',
|
||||
'x-youtube-client-name': info.desktop ? 1 : 2,
|
||||
'x-youtube-client-version': info.session.context.client.clientVersion,
|
||||
'x-youtube-chrome-connected': 'source=Chrome,mode=0,enable_account_consistency=true,supervised=false,consistency_enabled_by_default=false',
|
||||
@@ -113,7 +113,8 @@ module.exports = {
|
||||
formatNTransformData: (data) => {
|
||||
return data
|
||||
.replace(/function\(d,e\)/g, '"function(d,e)').replace(/function\(d\)/g, '"function(d)')
|
||||
.replace(/function\(\)/, '"function()').replace(/function\(d,e,f\)/g, '"function(d,e,f)')
|
||||
.replace(/function\(\)/g, '"function()').replace(/function\(d,e,f\)/g, '"function(d,e,f)')
|
||||
.replace(/\[function\(d,e,f\)/g, '["function(d,e,f)')
|
||||
.replace(/,b,/g, ',"b",').replace(/,b/g, ',"b"').replace(/b,/g, '"b",').replace(/b]/g, '"b"]')
|
||||
.replace(/\[b/g, '["b"').replace(/}]/g, '"]').replace(/},/g, '}",').replace(/""/g, '')
|
||||
.replace(/length]\)}"/g, 'length])}');
|
||||
|
||||
@@ -28,7 +28,7 @@ class OAuth extends EventEmitter {
|
||||
this.auth_script_regex = /<script id=\"base-js\" src=\"(.*?)\" nonce=".*?"><\/script>/;
|
||||
|
||||
// Used to find the credentials inside the script.
|
||||
this.identity_regex = /var .+?=\"(?<id>.+?)\",.?=\"(?<secret>.+?)\"/;
|
||||
this.identity_regex = /var .+?=\"(?<id>.+?)\",.+?=\"(?<secret>.+?)\"/;
|
||||
|
||||
if (creds.access_token != undefined && creds.refresh_token != undefined) return;
|
||||
this.requestAuthCode();
|
||||
@@ -77,7 +77,7 @@ class OAuth extends EventEmitter {
|
||||
const response = await Axios.get(script_url, Constants.DEFAULT_HEADERS).catch((error) => error);
|
||||
if (response instanceof Error) throw new Error(`Could not extract client identify: ${response.message}`);
|
||||
|
||||
const identity_function = Utils.getStringBetweenStrings(response.data, 'YTLR_STORAGE_NAMESPACE",', 'reloadAppFlushLogsMaxTimeoutMs:');
|
||||
const identity_function = Utils.getStringBetweenStrings(response.data, 'setQuery("");', '{useGaiaSandbox:');
|
||||
const client_identity = identity_function.replace(/\n/g, '').match(this.identity_regex);
|
||||
return client_identity.groups;
|
||||
}
|
||||
|
||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "youtubei.js",
|
||||
"version": "1.2.5",
|
||||
"version": "1.2.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "youtubei.js",
|
||||
"version": "1.2.5",
|
||||
"version": "1.2.6",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.4",
|
||||
@@ -137,9 +137,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/user-agents": {
|
||||
"version": "1.0.833",
|
||||
"resolved": "https://registry.npmjs.org/user-agents/-/user-agents-1.0.833.tgz",
|
||||
"integrity": "sha512-Vx6fikPUwMSR2emhgpVdmZz/OkiHS7f+n1hfW11US1dnYg7irTmBIP+or4R7GrG11ZU6J2hX3hx4iSriPPh67Q==",
|
||||
"version": "1.0.840",
|
||||
"resolved": "https://registry.npmjs.org/user-agents/-/user-agents-1.0.840.tgz",
|
||||
"integrity": "sha512-pdXizW5mvcHRHsJH50STUA+zywDvUKbxouQ2523FEmfYJCkLMVGavBSOL7u/VVmneVXM2EX20Ikru9lCnbNDeQ==",
|
||||
"dependencies": {
|
||||
"dot-json": "^1.2.2",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
@@ -254,9 +254,9 @@
|
||||
}
|
||||
},
|
||||
"user-agents": {
|
||||
"version": "1.0.833",
|
||||
"resolved": "https://registry.npmjs.org/user-agents/-/user-agents-1.0.833.tgz",
|
||||
"integrity": "sha512-Vx6fikPUwMSR2emhgpVdmZz/OkiHS7f+n1hfW11US1dnYg7irTmBIP+or4R7GrG11ZU6J2hX3hx4iSriPPh67Q==",
|
||||
"version": "1.0.840",
|
||||
"resolved": "https://registry.npmjs.org/user-agents/-/user-agents-1.0.840.tgz",
|
||||
"integrity": "sha512-pdXizW5mvcHRHsJH50STUA+zywDvUKbxouQ2523FEmfYJCkLMVGavBSOL7u/VVmneVXM2EX20Ikru9lCnbNDeQ==",
|
||||
"requires": {
|
||||
"dot-json": "^1.2.2",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "youtubei.js",
|
||||
"version": "1.2.5",
|
||||
"version": "1.2.6",
|
||||
"description": "An object-oriented library that allows you to search, get detailed info about videos, subscribe, unsubscribe, like, dislike, comment, download videos and much more!",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user