-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_all_tweet.py
executable file
·46 lines (34 loc) · 1.19 KB
/
delete_all_tweet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python3
import tweepy
"""
This script will delete all of the tweets in the specified account.
You will need to get a Twitter secret tokens to use this
script, you can do so here https://developer.twitter.com/en/portal/dashboard
@requirements: Python 3+, Tweepy
author: @chaignc
"""
BEARER_TOKEN = ""
API_KEY = ""
API_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
class Bot:
def connectAPI(self):
self.client = tweepy.Client(bearer_token=BEARER_TOKEN,
consumer_key=API_KEY, consumer_secret=API_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET)
self.user_id = self.client.get_me().data.id
def delete_last_10_tweets(self):
tweets = self.client.get_users_tweets(self.user_id)
if tweets.data is not None:
for tweet in tweets.data:
print(f"[+] deleting tweet {tweet.id} {repr(tweet.text)}")
self.client.delete_tweet(tweet.id)
else:
print("[+] No tweets to delete")
def main():
bot = Bot()
bot.connectAPI()
bot.delete_last_10_tweets()
main()