Trying a new approach

This commit is contained in:
Kasper Rynning-Tønnesen
2017-11-09 20:08:15 +01:00
parent b03213d61a
commit 375046d270

View File

@@ -972,17 +972,20 @@ var List = {
attr = ".vote-container"; attr = ".vote-container";
del_attr = "delete_button"; del_attr = "delete_button";
var url = "https://zoff.me:8081/https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg"; $.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + video_id
$.ajax({ + "&key=" + api_key + "&part=snippet",
type: "HEAD", function (data, status, xhr) {
url: url, if (data.items.length == 0) {
error: function(e) { setTimeout(function() {
if(e.status == 404) { socket.emit("error_video", {channel: chan.toLowerCase(), id: video_id, title: video_title});
setTimeout(function() { }, 500);
socket.emit("error_video", {channel: chan.toLowerCase(), id: video_id, title: video_title});
}, 500);
}
} }
}).error(function (xhr, errorType, exception) {
var errorMessage = exception || xhr.statusText || xhr.responseText;
setTimeout(function() {
socket.emit("error_video", {channel: chan.toLowerCase(), id: video_id, title: video_title});
}, 500);
}); });
var _temp_duration = Helper.secondsToOther(_song_info.duration); var _temp_duration = Helper.secondsToOther(_song_info.duration);