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
1 changed files with 11 additions and 2 deletions

View File

@ -729,7 +729,16 @@ function VimeoIsADoucheCopter(id, cb) {
};
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 json = data.substring(i+2, j+1);
try {
@ -766,7 +775,7 @@ function VimeoIsADoucheCopter(id, cb) {
}
Logger.errlog.log("Vimeo workaround error: ");
Logger.errlog.log(e);
Logger.errlog.log(data);
Logger.errlog.log("http://vimeo.com/" + id);
setImmediate(function () {
cb({});
});