I am trying to write a function that can succesfully create a List of all (or some) accounts who have liked a Tweet. To achieve this I have used Tweepys get_liking_users function. I have previously succesfully requested the Tweet Infos of some Tweets and am now using the Tweet ID of a Tweet I know for certain has been both liked and rewteeted (I checked it on Twitter).
This is my code:
def findLikers():
client = tweepy.Client(bearer_token='XXX')
id = 'XXX'
users = client.get_liking_users(id=id, max_results=10)
print(type(users))
print(users)
However, when running this I get an empty response as exemplified by my print statements. This is the Output:
<class 'tweepy.client.Response'>
Response(data=None, includes={}, errors=[], meta={'result_count': 0})
I'm pretty certain that the Tweet ID is correct, I looked it up on Twitter to ensure it is the tweet I mean (and actually has likes and retweets) and ran a seperate request to return the Tweet Text for the ID, which worked. However when running get_liking_users()
or get_retweers()
it consistently returns data=None, even though as I said, according to the UI there are both likes and retweets.
I tried to follow the tutorial here: https://dev.to/twitterdev/a-comprehensive-guide-for-using-the-twitter-api-v2-using-tweepy-in-python-15d9; and also saw this: Tweepy : How to get user id who liked(fav) the specified tweet, however I was unable to fix the problem.
(As the functions ittself are pretty new, I think Twitter introduced an endpoint for this in May 2021, I could not find a lot of material on them except the Stackoverflow post above)
Can anyone see what I'm doing wrong?
(If there's any more Information I can provide, I'd be happy to, this is my first time asking something here)
I tried running the tweepy get_liking_users function and also tried the same steps with the get_retweeters function. I was hoping, the request would return the User ID's of all Twitter accounts that had liked/retweeted the Tweet. However The data is always None. I tried using some other ID's of some other Tweets, however the result stayed the same.