Cookies Header function added

This commit is contained in:
killer069
2021-11-01 15:32:51 +05:30
parent 5214250eac
commit 703e36c78d
7 changed files with 24 additions and 13 deletions

View File

@@ -47,7 +47,8 @@ export function setCookieToken(options: { cookie: string }) {
youtubeData.file = false;
}
export function cookieHeaders(headCookie : string[]){
export function cookieHeaders(headCookie: string[]) {
if (!youtubeData?.cookie) return;
headCookie.forEach((x: string) => {
x.split(';').forEach((x) => {
const arr = x.split('=');
@@ -58,4 +59,4 @@ export function cookieHeaders(headCookie : string[]){
});
});
uploadCookie();
}
}

View File

@@ -6,7 +6,7 @@ import { InfoData } from '../stream';
interface InfoOptions {
proxy?: Proxy[];
htmldata? : boolean
htmldata?: boolean;
}
interface PlaylistOptions {
@@ -80,11 +80,10 @@ export function extractID(url: string): string {
* @returns Data containing video_details, LiveStreamData and formats of video url.
*/
export async function video_basic_info(url: string, options: InfoOptions = {}) {
let body : string;
if(options.htmldata){
let body: string;
if (options.htmldata) {
body = url;
}
else {
} else {
if (yt_validate(url) !== 'video') throw new Error('This is not a YouTube Watch URL');
const video_id: string = extractID(url);
const new_url = `https://www.youtube.com/watch?v=${video_id}&has_verified=1`;