From 7b9162f89036da6f6162b06c1c818b5ee83fe687 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 4 Feb 2014 22:02:27 -0600 Subject: [PATCH] Fix vimeo workaround --- lib/get-info.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/get-info.js b/lib/get-info.js index 3b103219..e0fb96f0 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -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({}); });