diff options
| author | Max Isom <[email protected]> | 2022-01-19 18:15:12 -0600 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2022-01-19 18:15:12 -0600 |
| commit | 7901fcce3d7d0ce2ec91ba36a3ba9107e8709bff (patch) | |
| tree | 3587d2d2e6c2f7a49118229453cf42f1b0629226 /src/utils | |
| parent | 43baa57c51ce25aadf7b9d5a75a992e6c1edc7da (diff) | |
| download | muse-7901fcce3d7d0ce2ec91ba36a3ba9107e8709bff.tar.xz muse-7901fcce3d7d0ce2ec91ba36a3ba9107e8709bff.zip | |
✨ add autocomplete
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/get-youtube-suggestions-for.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/get-youtube-suggestions-for.ts b/src/utils/get-youtube-suggestions-for.ts new file mode 100644 index 0000000..11977e4 --- /dev/null +++ b/src/utils/get-youtube-suggestions-for.ts @@ -0,0 +1,15 @@ +import got from 'got'; + +const getYouTubeSuggestionsFor = async (query: string): Promise<string[]> => { + const [_, suggestions] = await got('https://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q=', { + searchParams: { + client: 'firefox', + ds: 'yt', + q: query, + }, + }).json<[string, string[]]>(); + + return suggestions; +}; + +export default getYouTubeSuggestionsFor; |
