search for videos only using youtube api

This commit is contained in:
Lukáš Horáček 2020-04-11 16:18:42 +02:00
parent b5f7c70050
commit 5ae1ede3f3
No known key found for this signature in database
GPG key ID: E07D6630DBC17195

View file

@ -67,9 +67,9 @@ module.exports = client => {
let response;
if(isLink) {
response = await fetch('https://www.googleapis.com/youtube/v3/search?key=' + client.config.keys.yt + '&part=id,snippet&maxResults=1&id=' + id);
response = await fetch('https://www.googleapis.com/youtube/v3/search?key=' + client.config.keys.yt + '&part=id,snippet&maxResults=1&type=video&id=' + id);
} else {
response = await fetch('https://www.googleapis.com/youtube/v3/search?key=' + client.config.keys.yt + '&part=id,snippet&maxResults=1&q=' + encodeURIComponent(query));
response = await fetch('https://www.googleapis.com/youtube/v3/search?key=' + client.config.keys.yt + '&part=id,snippet&maxResults=1&type=video&q=' + encodeURIComponent(query));
};
let parsed = await response.json();