From 57cd5a5d305bc1bed0eeed2a15e8c656a9f624fc Mon Sep 17 00:00:00 2001 From: Killer069 <65385476+killer069@users.noreply.github.com> Date: Wed, 1 Dec 2021 20:43:16 +0530 Subject: [PATCH] Added Captcha Error in search --- play-dl/YouTube/search.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/play-dl/YouTube/search.ts b/play-dl/YouTube/search.ts index 7f9fedc..22c4e29 100644 --- a/play-dl/YouTube/search.ts +++ b/play-dl/YouTube/search.ts @@ -40,6 +40,8 @@ export async function yt_search(search: string, options: ParseSearchInterface = const body = await request(url, { headers: { 'accept-language': 'en-US,en-IN;q=0.9,en;q=0.8,hi;q=0.7' } }); + if (body.indexOf('Our systems have detected unusual traffic from your computer network.') !== -1) + throw new Error('Captcha page: YouTube has detected that you are a bot!'); const data = ParseSearchResult(body, options); return data; }