Created
July 1, 2022 08:35
-
-
Save vladimircicovic/ad85684bac4f1705e57875e4b5b82bf9 to your computer and use it in GitHub Desktop.
Deleting all tweets with tweepy 4.10.0
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
import tweepy | |
# tweepy version 4.10.0 | |
# This script remove all tweets | |
# go to https://developer.twitter.com/en/portal/projects-and-apps | |
# Add app, then click on app name, find Keys and Tokens | |
# Generate Access Token and Secret | |
# Replace all information with proper in <> and USERNAME of your developer account that using this tokens and keys | |
# reminder: you need to run more times bcs of Twitter limits | |
api_key = "<API_KEY>" | |
api_key_secret = "<API_KEY_SECRET>" | |
access_token = "<ACESS_TOKEN>" | |
access_token_secret = "<ACESS_TOKEN>" | |
# authenticate | |
auth = tweepy.OAuthHandler(api_key, api_key_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
# | |
for page in tweepy.Cursor(api.user_timeline, screen_name="USERNAME", count=200).pages(75): | |
for txt in page: | |
print(txt.text) | |
api.destroy_status(txt.id_str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment