From 69ac0b39ad0d34a5d4ec785f217a2931cb12e855 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 29 Sep 2013 21:32:04 -0500 Subject: [PATCH] Check for videos where embedding is disabled --- changelog | 4 ++++ lib/get-info.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/changelog b/changelog index 7e1d3292..07366dc1 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +Sun Sep 29 21:30 2013 CDT + * lib/get-info.js: Add an extra check to ytv2 to make sure embedding is + allowed. If not, send a queueFail. + Fri Sep 27 10:27 2013 CDT * lib/channel.js: Change the link regex, change the way 'affects links' works. The default link filter will only transform a link of no diff --git a/lib/get-info.js b/lib/get-info.js index 613dec23..9e93f7fe 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -91,6 +91,18 @@ module.exports = function (Server) { try { data = JSON.parse(data); + if (data.entry.yt$accessControl) { + var ac = data.entry.yt$accessControl; + for (var i = 0; i < ac.length; i++) { + if (ac[i].action === "embed") { + if (ac[i].permission === "denied") { + callback("Embedding disabled", null); + return; + } + break; + } + } + } var seconds = data.entry.media$group.yt$duration.seconds; var title = data.entry.title.$t; var media = new Media(id, title, seconds, "yt");