mirror of
https://github.com/imputnet/cobalt.git
synced 2026-02-06 05:56:59 +00:00
@@ -15,24 +15,27 @@ async function findClientID() {
|
|||||||
return cachedID.id;
|
return cachedID.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scripts = sc.matchAll(/<script.+src="(.+)">/g);
|
let clientid = sc.match(/"hydratable"\s*:\s*"apiClient"\s*,\s*"data"\s*:\s*\{\s*"id"\s*:\s*"([^"]+)"/)?.[1];
|
||||||
|
if (!clientid) {
|
||||||
|
const scripts = sc.matchAll(/<script.+src="(.+)">/g);
|
||||||
|
|
||||||
let clientid;
|
for (let script of scripts) {
|
||||||
for (let script of scripts) {
|
const url = script[1];
|
||||||
const url = script[1];
|
|
||||||
|
|
||||||
if (!url?.startsWith('https://a-v2.sndcdn.com/')) {
|
if (!url?.startsWith('https://a-v2.sndcdn.com/')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrf = await fetch(url).then(r => r.text()).catch(() => {});
|
const scrf = await fetch(url).then(r => r.text()).catch(() => {});
|
||||||
const id = scrf.match(/\("client_id=[A-Za-z0-9]{32}"\)/);
|
const id = scrf.match(/,client_id:"([A-Za-z0-9]{32})",/);
|
||||||
|
|
||||||
if (id && typeof id[0] === 'string') {
|
if (id && id.length >= 2) {
|
||||||
clientid = id[0].match(/[A-Za-z0-9]{32}/)[0];
|
clientid = id[1];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cachedID.version = scVersion;
|
cachedID.version = scVersion;
|
||||||
cachedID.id = clientid;
|
cachedID.id = clientid;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user