【问题标题】:Twitter Bot to Likes some tweets using rubyTwitter Bot 喜欢一些使用 ruby​​ 的推文
【发布时间】:2019-06-11 00:59:09
【问题描述】:

我是一名 Ruby 初学者,目前正在研究 Twitter API。

到目前为止,我已经学会了如何使用带有The Twitter Ruby Gem 的 twitter 机器人来发推文和查找推文。

def follow_hello(client)
    client.search("#Hello_World", result_type: "recent").take(20).map do |tweet|
      client.follow(tweet.user)
    end
end

如何使用#Hello_World“点赞”所有 20 条推文?

我试过了,但它不起作用:

client.search('#Hello_World', result_type: "recent").take(25).each do |like|

【问题讨论】:

    标签: ruby api twitter


    【解决方案1】:

    似乎有一个“favorite”调用,您可以通过将一系列推文传递给它。

    虽然我目前无法对其进行测试,但像这样应该工作:

    var tweets = client.search("#Hello_World", result_type: "recent").take(20)
    
    client.favorite(tweets)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-03
      • 1970-01-01
      • 2014-04-26
      • 2017-07-14
      • 1970-01-01
      • 2018-10-01
      • 1970-01-01
      • 2011-09-19
      相关资源
      最近更新 更多