Fix vimeo and hopefully make it more fault tolerant

This commit is contained in:
calzoneman 2014-02-04 16:04:22 -06:00
parent 2558a87e96
commit 0abc71c8e9

View file

@ -729,7 +729,16 @@ function VimeoIsADoucheCopter(id, cb) {
}; };
var parse = function (data) { var parse = function (data) {
var i = data.indexOf("b={"); var i = data.indexOf("a={");
if (i === -1) i = data.indexOf("b={");
if (i === -1) i = data.indexOf("c={");
if (i === -1) {
Logger.errlog.log("Bad embed response for http://vimeo.com/" + id);
setImmediate(function () {
cb({});
});
return;
}
var j = data.indexOf("};", i); var j = data.indexOf("};", i);
var json = data.substring(i+2, j+1); var json = data.substring(i+2, j+1);
try { try {
@ -766,7 +775,7 @@ function VimeoIsADoucheCopter(id, cb) {
} }
Logger.errlog.log("Vimeo workaround error: "); Logger.errlog.log("Vimeo workaround error: ");
Logger.errlog.log(e); Logger.errlog.log(e);
Logger.errlog.log(data); Logger.errlog.log("http://vimeo.com/" + id);
setImmediate(function () { setImmediate(function () {
cb({}); cb({});
}); });