【问题标题】:Get latest tweet from user_timeline with twit npm使用 twit npm 从 user_timeline 获取最新推文
【发布时间】:2020-10-11 10:59:50
【问题描述】:

我正在尝试创建一个带有新推文通知的不和谐机器人。

我为此使用T.stream('statuses/filter', { follow : ['798934987978510337'] });,但它也显示提及。

我可以只从有 twit 的用户那里获取推文吗?

【问题讨论】:

  • 语法和大写改写

标签: javascript node.js npm twitter


【解决方案1】:

不,statuses/filter 流媒体 API 也包含转推。如果您不想将转发传递给 Discord,则需要过滤掉您自己代码中的转发。

【讨论】:

    【解决方案2】:

    以下代码对我有用。参考https://twittercommunity.com/t/only-receive-latest-tweet-from-specific-user-twit-npm/151478

    var twitParams =
    {
      exclude_replies: false,
      count: 1,
      screen_name: "your screen name excluding @"
    }
    
    T.get("statuses/user_timeline", twitParams, function(err, data, response) {
      console.log(data);
    });
    

    【讨论】:

      猜你喜欢
      • 2017-07-31
      • 2015-04-10
      • 1970-01-01
      • 2015-05-15
      • 2019-11-26
      • 2021-01-29
      • 2017-11-23
      • 2021-11-17
      • 2013-02-02
      相关资源
      最近更新 更多