From 695d9c2daff856853b6ba6b04cf7c947bf72cb91 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 27 Dec 2021 12:17:24 +0530 Subject: [PATCH] Added a fix for 404 errors youtube. --- play-dl/YouTube/stream.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/play-dl/YouTube/stream.ts b/play-dl/YouTube/stream.ts index 5674895..115d059 100644 --- a/play-dl/YouTube/stream.ts +++ b/play-dl/YouTube/stream.ts @@ -1,7 +1,9 @@ +import { request_stream } from '../Request'; import { LiveStream, Stream } from './classes/LiveStream'; import { SeekStream } from './classes/SeekStream'; import { InfoData, StreamInfoData } from './utils/constants'; import { video_stream_info } from './utils/extractor'; +import { URL } from 'node:url'; export enum StreamType { Arbitrary = 'arbitrary', @@ -81,6 +83,7 @@ export async function stream_from_info( else final.push(info.format[info.format.length - 1]); let type: StreamType = final[0].codec === 'opus' && final[0].container === 'webm' ? StreamType.WebmOpus : StreamType.Arbitrary; + await request_stream(`https://${new URL(final[0].url).host}/generate_204`) if (options.seek) { if (type === StreamType.WebmOpus) { if (options.seek >= info.video_details.durationInSec || options.seek <= 0)