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";
del_attr = "delete_button";
var url = "https://zoff.me:8081/https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg";
$.ajax({
type: "HEAD",
url: url,
error: function(e) {
if(e.status == 404) {
$.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + video_id
+ "&key=" + api_key + "&part=snippet",
function (data, status, xhr) {
if (data.items.length == 0) {
setTimeout(function() {
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);