0

我正在尝试连接到 vine API以检索给定用户的上传视频列表。我正在使用一个名为Vineapple的node.js 模块

问题是一些 api 端点似乎不再工作了


这是一个有效的片段

var vine = new vineapple({
    key: 'some-key',
    userId: '123456789',
    username: 'user',
}); 
vine.me(function(err, response){  // calls 'https://api.vineapp.com/users/me'
    if(err) throw err;
    console.log(response);
});

这会记录整个 vine 用户的设置:

{ followerCount: 300,
  includePromoted: 2,
  userId: '123456789',
  private: 0,
  likeCount: 30,
  ... etc }

这是一个不起作用的片段

var vine = new vineapple({
    key: 'some-key',
    userId: '123456789',
    username: 'user',
}); 
vine.user(connectionObject.userId.toString(), function(err, response){    // calls 'https://api.vineapp.com/timelines/users/{userId}'
    if(err) throw err;
    console.log(response);
});

这永远不会返回任何东西。

所有 vine api 端点是否仍然可用?

  • 如果是,我的问题可能是什么?
  • 如果没有,是否有其他解决方案来检索藤视频?

谢谢

4

1 回答 1

1

对于那些想知道的人。

至于今天(2014年4月),藤非官方api还在涨。你可以在这里测试它:https ://api.vineapp.com/timelines/users/920890957405237248

我遇到了 node.js vineapple 模块的问题:

1/ 你应该总是用promise 语法调用 vineapple 函数: https ://github.com/furf/vineapple#promises

2/ Vine 使用大整数作为用户 id,js 无法处理这些,所以你应该将 userId 作为 js 字符串而不是数字发送(我将它存储为整数。.toString()这里没用)

3/ vineapple 模块中有一个已知的错误,你应该评论 vineapple.js 的第 121 行https ://github.com/furf/vineapple/issues/2

作为结论,这是我的代码的样子:

var vine = new vineapple({
    key: key,
    userId: userId,     // Stored as String !
    username: username,
});
options= {page: '1', size: '20'};

vine.user(userId, options).then(function (response) {
    console.log('SUCCESS', response);
}).fail(function (error) {
    console.log('ERROR', error);
});

希望能帮助到你

于 2014-04-16T08:20:14.013 回答