Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
d60 authored Mar 9, 2024
1 parent 972770b commit c919a4d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ client.create_tweet(
)
```

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

## Contributing
I would like to hear your thoughts and suggestions.
Expand Down
40 changes: 40 additions & 0 deletions examples/delete_all_tweets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import asyncio
import time

from twikit.twikit_async import Client

AUTH_INFO_1 = '...'
AUTH_INFO_2 = '...'
PASSWORD = '...'

client = Client('en-US')


async def main():
started_time = time.time()

client.load_cookies('cookies.json')
client_user = await client.user()

# Get all posts
all_tweets = []
tweets = await client_user.get_tweets('Replies')
all_tweets += tweets

while len(tweets) != 0:
tweets = await tweets.next()
all_tweets += tweets

tasks = []
for tweet in all_tweets:
tasks.append(tweet.delete())

gather = asyncio.gather(*tasks)
await gather

print(
f'Deleted {len(all_tweets)} tweets\n'
f'Time: {time.time() - started_time}'
)

asyncio.run(main())

0 comments on commit c919a4d

Please sign in to comment.