Fix vimeo workaround

This commit is contained in:
calzoneman 2014-02-04 22:02:27 -06:00
parent 12596cb357
commit 7b9162f890
1 changed files with 10 additions and 3 deletions

View File

@ -726,9 +726,16 @@ function vimeoWorkaround(id, cb) {
};
var parse = function (data) {
var i = data.indexOf("b={");
var i = data.indexOf("{\"cdn_url\"");
if (i === -1) {
Logger.errlog.log("Vimeo workaround failed (i=-1): http://vimeo.com/" + id);
setImmediate(function () {
cb({});
});
return;
}
var j = data.indexOf("};", i);
var json = data.substring(i+2, j+1);
var json = data.substring(i, j+1);
try {
json = JSON.parse(json);
var codec = json.request.files.codecs[0];
@ -761,7 +768,7 @@ function vimeoWorkaround(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({});
});