From 4b65b9128af0adb2b7aad94a661316120e08ad8a Mon Sep 17 00:00:00 2001 From: Xaekai Date: Wed, 25 Mar 2015 11:32:14 -0700 Subject: [PATCH] Fix rare error where only unsupported qualities of video are present in metadata on Picasa --- lib/get-info.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/get-info.js b/lib/get-info.js index b8454326..fdf5ba08 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -845,11 +845,14 @@ var Getters = { var videos = {}; $('media\\:content[medium="video"]').each(function(index, element){ var url = $(this).attr("url") - var type = url.match(/itag=(\d\d)/)[1] - videos[type] = { - format: type, - link: url - }; + var type = url.match(/itag=(\d\d)/) + if(type && type[1]){ + type = type[1] + videos[type] = { + format: type, + link: url + }; + } }); $ = null; @@ -870,8 +873,8 @@ var Getters = { } if (Object.keys(direct).length === 0) { - return cb("Unable to retrieve video data from Google+. Check that " + - "the album exists and is shared publicly."); + return cb("Unable to retrieve video data from Google+. The videos " + + "may have not finished processing yet."); } else if (!title) { return cb("Unable to retrieve title from Google+. Check that " + "the album exists and is shared publicly.");