diff --git a/lib/get-info.js b/lib/get-info.js index 0ae25e13..871a8214 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -713,13 +713,14 @@ var Getters = { /* * Preference map of quality => youtube formats. * see https://en.wikipedia.org/wiki/Youtube#Quality_and_codecs + * + * Prefer WebM over MP4, ignore other codecs (e.g. FLV) */ const preference = { "hd1080": [46, 37], - "hd720": [22, 45], - "large": [44, 35], - "medium": [43, 18], - "small": [5] + "hd720": [45, 22], + "large": [44, 59], + "medium": [43, 18] }; var direct = {}; @@ -848,10 +849,9 @@ var Getters = { */ const preference = { "hd1080": [46, 37], - "hd720": [22, 45], - "large": [44, 35], - "medium": [43, 18], - "small": [5] + "hd720": [45, 22], + "large": [44, 59], + "medium": [43, 18] }; var direct = {}; diff --git a/www/js/util.js b/www/js/util.js index ee714824..16294cc0 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -2749,15 +2749,18 @@ function googlePlusSimulator2014(data) { var fallbacks = ["hd1080", "hd720", "large", "medium", "small"]; var i = fallbacks.indexOf(q); if (i < 0) { - // Default to 360p because 480p is Flash i = fallbacks.indexOf("medium"); } while (!(q in data.meta.gpdirect) && i < fallbacks.length) { q = fallbacks[i++]; } + if (i === fallbacks.length) { - q = "medium"; + var hasCodecs = Object.keys(data.meta.gpdirect); + if (hasCodecs.length > 0) { + q = hasCodecs[0]; + } } data.url = data.meta.gpdirect[q];