Authentication Error fixes

This commit is contained in:
killer069 2021-10-01 12:08:46 +05:30
parent 03055ba0a6
commit 193c611465
2 changed files with 4 additions and 4 deletions

View File

@ -134,7 +134,7 @@ export class Stream {
private data_ended: boolean;
private playing_count: number;
private quality: number;
private proxy: Proxy[];
private proxy: Proxy[] | undefined ;
private request: IncomingMessage | null;
constructor(
url: string,
@ -148,7 +148,7 @@ export class Stream {
this.stream = new PassThrough({ highWaterMark: 10 * 1000 * 1000 });
this.url = url;
this.quality = options.quality as number;
this.proxy = options.proxy || [];
this.proxy = options.proxy || undefined;
this.type = type;
this.bytes_count = 0;
this.video_url = video_url;

View File

@ -67,7 +67,7 @@ export async function video_basic_info(url: string, options: InfoOptions = {}) {
} else video_id = url;
const new_url = `https://www.youtube.com/watch?v=${video_id}&has_verified=1`;
const body = await request(new_url, {
proxies: options.proxy ?? [],
proxies: options.proxy ?? undefined,
headers: options.cookie
? {
'cookie': options.cookie,
@ -185,7 +185,7 @@ export async function playlist_info(url: string, options: PlaylistOptions = {}):
const new_url = `https://www.youtube.com/playlist?list=${Playlist_id}`;
const body = await request(new_url, {
proxies: options.proxy ?? [],
proxies: options.proxy ?? undefined,
headers: { 'accept-language': 'en-US,en-IN;q=0.9,en;q=0.8,hi;q=0.7' }
});
const response = JSON.parse(body.split('var ytInitialData = ')[1].split(';</script>')[0]);