我使用Vimeo api
作为node.js
,现在遇到了以前从未发生过的问题。尝试lib.generateClientCredentials
时会引发错误(并使节点应用崩溃):
[Error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="nofollow, noindex">
<title>Sorry. Vimeo will be right back.</title>
<style>
body {
margin: 0;
padding: 0;
background: #34454E url('https://f.vimeocdn.com/images_v6/ins_down_illustr
ation.png') bottom repeat-x fixed;
color: #ffffff;
font: 36px/1.3 Helvetica, Arial, sans-serif;
text-align: center;
}
#content {
position: fixed;
width: 100%;
top: 35px;
left: 0;
}
h1 {
margin-bottom: 35px;
height: 101px;
background: url('https://f.vimeocdn.com/images_v6/ins_down_vimeo.png') cen
ter no-repeat;
text-indent: -1000em;
overflow: hidden;
}
h2 {
color: #717D83;
font-size: 37px;
font-weight: normal;
margin-bottom: 5px;
}
p {
margin: 0;
}
@media all and (min-height: 960px) {
#content {
top: 5%;
}
}
@media all and (min-height: 1200px) {
#content {
top: 10%;
}
}
@media all and (max-height: 900px) {
body {
background-position: center 300px;
}
#content {
top: 0;
}
}
</style>
</head>
<body>
<div id="content">
<h1>Vimeo</h1>
<h2>Something is weird in the magical forest.</h2>
<p>We’ll be back in a jiffy.</p>
</div>
</body>
</html>]
所以:
1.为什么会发生?
2.为什么将HTML作为服务器端api中的错误抛出? (将其传递给我假设的用户?)
编辑:
我的
Vimeo-API
配置模块(与Vimeo
文档中的示例基本相同):var Vimeo = require('vimeo-api').Vimeo;
var lib = new Vimeo('*somethingsecret*', '*anothersecretthing*');
lib.generateClientCredentials('public', function (err, access_token) {
if (err) {
console.log(err);
}
var token = access_token.access_token;
lib.access_token = token;
// Other useful information is included alongside the access token
// We include the final scopes granted to the token. This is important because the user (or api) might revoke scopes during the authentication process
var scopes = access_token.scope;
});
module.exports = lib;
Edit2:安装
vimeo 0.1.4 module
后,第一次服务器启动成功,vimeo api正常运行,但是在任何api请求重启后,我都收到了error: A valid user token must be passed
。有时它在服务器重新加载后就可以工作,有时它会引发此错误。
最佳答案
这是服务器端的临时错误。 Vimeo已将更新推送到官方的node.js库,该库应该在解决问题时绕过该问题。
确保您使用的是vimeo
软件包,而不是vimeo-api
软件包,并且您使用的是1.1.3
版本
关于html - Vimeo-API用于node.js HTML错误 'Sorry. Vimeo will be right back',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29954095/