Add option to unblur thumbnails in YouTube search results

This commit is contained in:
absidue
2022-02-03 18:23:14 +01:00
parent 5d4485a54e
commit 9670e6ccfb
2 changed files with 65 additions and 3 deletions

View File

@@ -67,6 +67,11 @@ interface SearchOptions {
};
fuzzy?: boolean;
language?: string;
/**
* !!! Before enabling this for public servers, please consider using Discord features like NSFW channels as not everyone in your server wants to see NSFW images. !!!
* Unblurred images will likely have different dimensions than specified in the {@link YouTubeThumbnail} objects.
*/
unblurNSFWThumbnails?: boolean;
}
import { createInterface } from 'node:readline';
@@ -184,6 +189,9 @@ async function search(query: string, options?: SearchOptions): Promise<YouTubeVi
*
* - `number` limit : No of searches you want to have.
* - `string` language : Sets language of searched content [ YouTube search only. ], e.g. "en-US"
* - `boolean` unblurNSFWThumbnails : Unblurs NSFW thumbnails. Defaults to `false` [ YouTube search only. ]
* !!! Before enabling this for public servers, please consider using Discord features like NSFW channels as not everyone in your server wants to see NSFW images. !!!
* Unblurred images will likely have different dimensions than specified in the {@link YouTubeThumbnail} objects.
* - `boolean` fuzzy : Whether the search should be fuzzy or only return exact matches. Defaults to `true`. [ for `Deezer` Only ]
* - `Object` source : Contains type of source and type of result you want to have
* ```ts
@@ -204,7 +212,8 @@ async function search(
return await yt_search(query, {
limit: options.limit,
type: options.source.youtube,
language: options.language
language: options.language,
unblurNSFWThumbnails: options.unblurNSFWThumbnails
});
else if (options.source.spotify) return await sp_search(query, options.source.spotify, options.limit);
else if (options.source.soundcloud) return await so_search(query, options.source.soundcloud, options.limit);