Closed glaucocustodio closed 11 months ago
Hey, I am using the following hack to get user ids who liked a tweet:
gem 'twitter', '~> 7.0'
# config/initializers/twitter_ext.rb module Twitter module REST module Tweets # return empty array if tweet has no likes # return array of user_ids otherwise def liking_user_ids(tweet_id) response = perform_get_with_objects("/2/tweets/#{tweet_id}/liking_users", {}, Twitter::Base) response.find { _1.attrs[0] == :data }&.attrs&.fetch(1, [])&.map{ _1[:id].to_i } || [] end end end end
It consumes the v2 api.
Would a PR adding such a method be welcome? Of course I would need to properly deal with the response instead of doing this mess.
Hey, I am using the following hack to get user ids who liked a tweet:
It consumes the v2 api.
Would a PR adding such a method be welcome? Of course I would need to properly deal with the response instead of doing this mess.