d60 / twikit

Twitter API Scraper | Without an API key | Twitter Internal API | Free | Twitter scraper | Twitter Bot
https://twikit.readthedocs.io/en/latest/twikit.html
MIT License
1.18k stars 134 forks source link

Account locked #182

Open Eitan007 opened 3 weeks ago

Eitan007 commented 3 weeks ago

Define your async function

async def login_user(client, username, email, password): await client.login(auth_info_1=username, auth_info_2=email, password=password) return client

Define the function to handle saving cookies

def save_cookies(client, filename='cookies.json'):

Assuming client.save_cookies is an async function

client.save_cookies(filename)

Main function to run the asynchronous code

async def main(client, username, email, password): client = await login_user(client, username, email, password) save_cookies(client)

def load_cookies(client, filename='cookies.json'): client.load_cookies(filename)

async def search_user_0(query, count=1): user_profile_results = await client.search_user(query, count,) return user_profile_results

if name == "main":

# login credentials              
config = ConfigParser()
config.read('config.ini')
username = config['X']['username']
email = config['X']['email']
password = config['X']['password']

# create client
client = Client(language='en-US')

# Run the main function with asyncio
#asyncio.run(main(client, username, email, password))
load_cookies(client)

# # params
minimum_users = 1
query = input('Type in username: ')
query = f'@{query}'

user_profile_results = asyncio.run(search_user_0(query, 1))
#print(user_profile_results)

# # get point-zero username profile
for user in user_profile_results:
    print(vars(user))
    break

My accounts keep getting locked. does anyone know a way around this?

Eitan007 commented 3 weeks ago

being using vpn and kept the 'count' param at 20 for search_user()