fixed channel icon issues

This commit is contained in:
killer069
2021-11-22 13:13:00 +05:30
parent c0d3dc68bf
commit 283d864183
5 changed files with 135 additions and 44 deletions

View File

@@ -46,12 +46,23 @@ export function setCookieToken(options: { cookie: string }) {
youtubeData = { cookie };
youtubeData.file = false;
}
export function cookieHeaders(headCookie: string[]) {
/**
* Updates cookies locally either in file or in memory.
*
* Example
* ```ts
* const response = ... // Any https package get function.
*
* play.cookieHeaders(response.headers['set-cookie'])
* ```
* @param headCookie response headers['set-cookie'] array
* @returns Nothing
*/
export function cookieHeaders(headCookie: string[]): void {
if (!youtubeData?.cookie) return;
headCookie.forEach((x: string) => {
x.split(';').forEach((x) => {
const arr = x.split('=');
x.split(';').forEach((z) => {
const arr = z.split('=');
if (arr.length <= 1) return;
const key = arr.shift()?.trim() as string;
const value = arr.join('=').trim();