Cookies fixes

This commit is contained in:
killer069
2021-10-09 13:55:33 +05:30
parent 568624efe0
commit e4bce76c4a
2 changed files with 12 additions and 9 deletions

View File

@@ -183,10 +183,10 @@ export function authorization(): void {
console.log('Cookies has been added successfully.');
let cookie: Object = {};
cook.split(';').forEach((x) => {
let [ key, value ] = x.split('=')
if(!value) return;
key = key.trim()
value = value.trim()
const arr = x.split('=')
if(arr.length <= 1 ) return;
const key = arr.shift()?.trim() as string
const value = arr.join('=').trim()
Object.assign(cookie, { [key] : value })
})
fs.writeFileSync('.data/youtube.data', JSON.stringify({ cookie }, undefined, 4));