Added Captcha Error in search

This commit is contained in:
Killer069 2021-12-01 20:43:16 +05:30 committed by GitHub
parent 50d6d930b4
commit 57cd5a5d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,8 @@ export async function yt_search(search: string, options: ParseSearchInterface =
const body = await request(url, { const body = await request(url, {
headers: { 'accept-language': 'en-US,en-IN;q=0.9,en;q=0.8,hi;q=0.7' } 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); const data = ParseSearchResult(body, options);
return data; return data;
} }