Fixed issue with channels having spaces

This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-18 18:19:42 +01:00
parent 2e29f8e20f
commit f70cf00fd1
11 changed files with 55 additions and 37 deletions

View File

@@ -9,6 +9,7 @@ try {
}
function get_correct_info(song_generated, channel, broadcast, callback) {
channel = channel.replace(/ /g,'');
request({
type: "GET",
url: "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+key+"&id=" + song_generated.id,
@@ -84,7 +85,7 @@ function check_error_video(msg, channel) {
}
return;
}
channel = channel.replace(/ /g,'');
request({
type: "GET",
url: "https://www.googleapis.com/youtube/v3/videos?part=id&key="+key+"&id=" + msg.id,
@@ -102,6 +103,7 @@ function check_error_video(msg, channel) {
}
function findSimilar(msg, channel, broadcast, callback) {
channel = channel.replace(/ /g,'');
var yt_url = "https://www.googleapis.com/youtube/v3/search?key="+key+"&videoEmbeddable=true&part=id&type=video&order=viewCount&safeSearch=none&maxResults=5&q=" + encodeURIComponent(msg.title);
request({
method: "GET",