Can't Delete More Than 3000 Favorites?

python
api

#1
def get_oauth():
    oauth = OAuth1(CONSUMER_KEY,
                client_secret=CONSUMER_SECRET,
                resource_owner_key=OAUTH_TOKEN,
                resource_owner_secret=OAUTH_TOKEN_SECRET)
    return oauth

while 1 == 1:

        if __name__ == "__main__":
                oauth = get_oauth()

                for i in xrange(8):
                        # get favorites tweet data (maximum 200 per call, "count=200"
                        r = requests.get(url="https://api.twitter.com/1.1/favorites/list.json?count=200", auth=oauth)
                            # store fav_ids in a list
                        with open("Output.txt", "w") as text_file:
                                text_file.write(str(r))
                                text_file.write("Done!")
                        fav_ids = [fav['id'] for fav in r.json()]
                        # loop through each fav id and remove from twitter
                        for fav in fav_ids :
                                data = {'id' : fav}
                                response = requests.post(url="https://api.twitter.com/1.1/favorites/destroy.json",auth=oauth,data=data)
                        print i

This file worked for the first three thousand favorites (which would be the equivalent of it running twice then stopped. The i still prints out but no favorites come back. I thought it was a day rate limit but it wasn’t.

Is it just that the Twitter API won’t return past a certain date/volume of favorites?


#2

Thanks for the thoughtful question. This is before my time, and the behavior you explained is consistent with this older blog post.

I’ll poke around to see if I can get a definitive answer, but my hunch right now is that it’s not possible.


#3

Quick update: We only return the user’s most recent 3200 favorited tweets, so you won’t be able to retrieve any older favorites to delete (in the vast majority of circumstances).


#4

This topic was automatically closed after 12 hours. New replies are no longer allowed.