Removed useless function - cookiesHeaders

This commit is contained in:
killer069 2021-11-23 09:50:44 +05:30
parent c24b417f39
commit 6fe9372989
3 changed files with 0 additions and 27 deletions

View File

@ -1,7 +1,6 @@
export { stream, stream_from_info, YouTubeStream } from './stream'; export { stream, stream_from_info, YouTubeStream } from './stream';
export * from './utils'; export * from './utils';
export { YouTube } from './search'; export { YouTube } from './search';
export { cookieHeaders } from './utils/cookie';
export { YouTubeVideo } from './classes/Video' export { YouTubeVideo } from './classes/Video'
export { YouTubePlayList } from './classes/Playlist' export { YouTubePlayList } from './classes/Playlist'
export { YouTubeChannel } from './classes/Channel' export { YouTubeChannel } from './classes/Channel'

View File

@ -46,28 +46,3 @@ export function setCookieToken(options: { cookie: string }) {
youtubeData = { cookie }; youtubeData = { cookie };
youtubeData.file = false; youtubeData.file = false;
} }
/**
* 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((z) => {
const arr = z.split('=');
if (arr.length <= 1) return;
const key = arr.shift()?.trim() as string;
const value = arr.join('=').trim();
setCookie(key, value);
});
});
uploadCookie();
}

View File

@ -7,7 +7,6 @@ export {
extractID, extractID,
YouTube, YouTube,
YouTubeStream, YouTubeStream,
cookieHeaders,
YouTubeChannel, YouTubeChannel,
YouTubePlayList, YouTubePlayList,
YouTubeVideo YouTubeVideo