Last active
March 21, 2018 19:12
-
-
Save davejm/80d983ee0e7eb4ea6949db96b274b796 to your computer and use it in GitHub Desktop.
This script will unfavourite all of the tweets you have favourited (liked)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will unfavourite all of the tweets you have favourited (liked). | |
# Install tweepy with pip install tweepy or pip3 install tweepy for python3 | |
# Create a Twitter app at https://apps.twitter.com/. Give it read and write permissions. Click on the app and go to Keys and Access tokens to find the credentials. | |
import tweepy | |
consumer_key = "" | |
consumer_secret = "" | |
access_token = "" | |
access_token_secret = "" | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) | |
def process_fav(favs): | |
for fav in favs: | |
api.destroy_favorite(fav.id) | |
while True: | |
page = api.favorites(page=0) | |
if len(page) == 0: | |
break | |
process_fav(page) | |
print("Finished") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment