I am writing a tweepy script to un-like (un-favorite [sic]) tweets.
However, I get an error when I try to unlike many messages, “message not found”.
try:
api.destroy_favorite(f.id)
print("SUCCESS {}".format(f.text))
except tweepy.error.TweepError:
print("FAILURE {} {}".format(f.text, f.id))
time.sleep(6)
api.create_favorite(f.id)
time.sleep(6)
api.destroy_favorite(f.id)
The resolution seems to be, as the script shows, to favorite the tweet and then un-favorite it.
If I click on the “/i/likes” regular web endpoint for my user I see about 11k liked tweets but none of them have a heart beside them. If I click the heart, then unclick the heart, it is removed from the list. This agrees with what I’m seeing on the API endpoints.
Is it possible that my user’s favorite list has somehow gotten into a bad “troolean” state of not being liked, but also not being un-liked? Can I ask Twitter to fix this or should I continue with my hack of liking and then unliking everything, which will piss off about 11k people as I go through the list.
UPDATE the favourites list is coming back empty after the first few pages of results and this workaround no longer works. It seems that older (1+ month) likes are put into cold storage and cannot be accessed via the REST API.