【问题标题】:unofficial vine api not working非官方的 vine api 不起作用
【发布时间】:2014-04-15 11:11:55
【问题描述】:

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

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


这是一个有效的 sn-p

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 }

这是一个不起作用的sn-p

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 端点仍然可用吗?

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

谢谢

【问题讨论】:

    标签: node.js vine


    【解决方案1】:

    对于那些想知道的人。

    至于今天(2014 年 4 月),vine 非官方 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 模块有一个已知的bug,你应该comment line 121 of vineapple.jshttps://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-10-27
      • 2013-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多