mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
Cookies Header function added
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user