davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.52k stars 928 forks source link

Not able to fetch more than 10 users for a particular keyword #1148

Open SunnyChopra7 opened 1 month ago

SunnyChopra7 commented 1 month ago

I am using api.search.users to search for a keyword

My goal is to fetch all the accounts for that keyword but the code is returning only 10 results for any keyword

sandbox code func.

async def get_users():
    cursor = 0
    async with TikTokApi() as api:

        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, headless=False)
        while cursor <= 50:
            async for user in api.search.users(search_term='axis bank', count=30, cursor=cursor):
                print(user)
                ite(json.dumps(users, indent=4))
            cursor += 30

Expected behavior

Let's say if the keyword is 'abcd' and there are 100 accounts that matches with this it should return all 100 accounts

Error trace: In search.py file if not resp.get("has_more", False): This has_more is coming false from response even if more data is present