我正在将 Vimeo api
用于 node.js
,现在遇到了以前从未出现过的问题。尝试 lib.generateClientCredentials
时,它会抛出错误(并使 Node 应用程序崩溃):
[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;
编辑2:安装vimeo 0.1.4模块
后,第一次服务器启动成功,vimeo api工作正常,但重新启动后,在任何api请求上,我都收到
错误:必须传递有效的用户 token
。
有时它会在服务器重新加载后起作用,有时它会开始抛出此错误。
最佳答案
这是一个临时服务器端错误。 Vimeo 已推送官方 Node.js 库的更新,该更新应该可以在我们努力解决问题时绕过该问题。
确保您使用的是 vimeo
包,而不是 vimeo-api
并且您使用的是 1.1.3
版本
关于html - Node.js 的 Vimeo-API HTML 错误 'Sorry. Vimeo will be right back',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29954095/