Skip to content

Commit c919a4d

Browse files
authored
Add files via upload
1 parent 972770b commit c919a4d

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ client.create_tweet(
6868
)
6969
```
7070

71-
More Examples: [example.py](https://github.com/d60/twikit/blob/main/example.py) <br>
72-
Async Examples: [example_async.py](https://github.com/d60/twikit/blob/main/example_async.py) <br>
73-
Rate Limits: [ratelimits.md](https://github.com/d60/twikit/blob/main/ratelimits.md)
71+
More Examples: [examples](https://github.com/d60/twikit/tree/main/examples) <br>
7472

7573
## Contributing
7674
I would like to hear your thoughts and suggestions.

examples/delete_all_tweets.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import asyncio
2+
import time
3+
4+
from twikit.twikit_async import Client
5+
6+
AUTH_INFO_1 = '...'
7+
AUTH_INFO_2 = '...'
8+
PASSWORD = '...'
9+
10+
client = Client('en-US')
11+
12+
13+
async def main():
14+
started_time = time.time()
15+
16+
client.load_cookies('cookies.json')
17+
client_user = await client.user()
18+
19+
# Get all posts
20+
all_tweets = []
21+
tweets = await client_user.get_tweets('Replies')
22+
all_tweets += tweets
23+
24+
while len(tweets) != 0:
25+
tweets = await tweets.next()
26+
all_tweets += tweets
27+
28+
tasks = []
29+
for tweet in all_tweets:
30+
tasks.append(tweet.delete())
31+
32+
gather = asyncio.gather(*tasks)
33+
await gather
34+
35+
print(
36+
f'Deleted {len(all_tweets)} tweets\n'
37+
f'Time: {time.time() - started_time}'
38+
)
39+
40+
asyncio.run(main())

0 commit comments

Comments
 (0)