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:
parent
4577a2dbd5
commit
a2f2b1adc2
4 changed files with 38 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue