Add support for Vimeo's OAuth ("advanced") API

This allows for authenticated API requests.  Currently, the only reason
you would want to use this is to be able to add videos that are marked
private but still embeddable.
This commit is contained in:
Calvin Montgomery 2014-04-04 20:03:34 -05:00
parent 4577a2dbd5
commit bdd4744b8c
4 changed files with 38 additions and 4 deletions

View File

@ -97,6 +97,16 @@ aliases:
# Workaround for Vimeo blocking my domain
vimeo-workaround: false
# OPTIONAL: Use Vimeo's OAuth API instead of the anonymous API.
# This allows you to add private videos that have embedding enabled.
# See https://developer.vimeo.com/apps/new to register for this API.
# Note that in order to use this feature you must agree to Vimeo's
# Terms of Service and License Agreement.
vimeo-oauth:
enabled: true
consumer-key: ''
secret: ''
# Regular expressions for defining reserved user and channel names and page titles
# The list of regular expressions will be joined with an OR, and compared without
# case sensitivity.

View File

@ -402,7 +402,30 @@ var Getters = {
null,
null,
function (err, data, res) {
console.log(err, data);
if (err) {
return callback(err, null);
}
try {
data = JSON.parse(data);
if (data.stat !== "ok") {
return callback(data.err.msg, null);
}
var video = data.video[0];
if (video.embed_privacy !== "anywhere") {
return callback("Embedding disabled", null);
}
var id = video.id;
var seconds = parseInt(video.duration);
var title = video.title;
callback(null, new Media(id, title, seconds, "vi"));
} catch (e) {
callback("Error handling Vimeo response", null);
}
});
},

View File

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const VERSION = "3.0.0-RC2";
const VERSION = "3.0.1";
var singleton = null;
var Config = require("./config");

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.0.0-RC2",
"version": "3.0.1",
"repository": {
"url": "http://github.com/calzoneman/sync"
},
@ -15,6 +15,7 @@
"nodemailer": "~0.6.0",
"cookie": "~0.1.0",
"yamljs": "~0.1.4",
"express-minify": "0.0.7"
"express-minify": "0.0.7",
"oauth": "^0.9.11"
}
}