bump youtubei.js to 5.0.0 and remove unnecessary twitter cookies

This commit is contained in:
wukko 2023-04-29 17:05:32 +06:00
parent 8f93232e81
commit ce6aa0e1ce
2 changed files with 4 additions and 14 deletions

View file

@ -34,6 +34,6 @@
"node-cache": "^5.1.2",
"url-pattern": "1.0.3",
"xml-js": "^1.6.11",
"youtubei.js": "4.3.0"
"youtubei.js": "5.0.0"
}
}

View file

@ -26,12 +26,7 @@ export default async function(obj) {
if (!req_act) return { error: 'ErrorCouldntFetch' };
_headers["x-guest-token"] = req_act["guest_token"];
_headers["cookie"] = [
`guest_id_ads=v1%3A${req_act["guest_token"]}`,
`guest_id_marketing=v1%3A${req_act["guest_token"]}`,
`guest_id=v1%3A${req_act["guest_token"]}`,
`ct0=${crypto.randomUUID().replace(/-/g, '')};`
].join('; ');
_headers["cookie"] = `guest_id=v1%3A${req_act["guest_token"]};`;
if (!obj.spaceId) {
let conversation = await fetch(conversationURL, { headers: _headers }).then((r) => { return r.status === 200 ? r.json() : false }).catch((e) => { return false });
@ -47,13 +42,8 @@ export default async function(obj) {
}).then((r) => { return r.status === 200 ? r.json() : false}).catch(() => { return false });
if (!req_act) return { error: 'ErrorCouldntFetch' };
_headers["x-guest-token"] = req_act["guest_token"]
_headers['cookie'] = [
`guest_id_ads=v1%3A${req_act["guest_token"]}`,
`guest_id_marketing=v1%3A${req_act["guest_token"]}`,
`guest_id=v1%3A${req_act["guest_token"]}`,
`ct0=${crypto.randomUUID().replace(/-/g, '')};`
].join('; ');
_headers["x-guest-token"] = req_act["guest_token"];
_headers['cookie'] = `guest_id=v1%3A${req_act["guest_token"]};`;
conversation = await fetch(conversationURL, { headers: _headers }).then((r) => { return r.status === 200 ? r.json() : false }).catch(() => { return false });
}