twikit
twikit copied to clipboard
Sometimes get the error: twikit.errors.TwitterException
Most of the time, after I try to login, I get the following error:
""" twikit.errors.TwitterException: Nous avons bloqué une tentative d'accès à votre compte car nous n'étions pas sûrs qu'il s'agissait bien de vous.
Cela se produit quand nous constatons une activité de connexion inhabituelle, comme des tentatives de connexion trop nombreuses, ou depuis un lieu ou un appareil différent.
Vous devrez attendre avant d'essayer de vous reconnecter. Certains blocages sont supprimés automatiquement. """
Code:
import asyncio
import time
from twikit import Client
usernames = [...]
emails = [...]
passwords = [...]
clients = []
for _ in range(NUM_ACCOUNTS):
clients.append(Client('en-US'))
async def scrape_tweets():
for i, client in enumerate(clients):
await client.login(
auth_info_1=usernames[i],
auth_info_2=emails[i],
password=passwords[i]
)
time.sleep(5)
Use a proxy, don't make too many login attempts