davidteather / TikTok-Api

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

[BUG] - Can't Playwright Sync API inside the asyncio loop #1079

Open claire-yiting-zhang opened 1 year ago

claire-yiting-zhang commented 1 year ago

Fill Out the template :)

Describe the bug

Error said "It looks like you are suing Playwright Sync API inside the asyncio loop. Please use the Async API instead."

The buggy code

async def get_hashtag_videos(): async with TikTokApi() as api: await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3) tag = api.hashtag(name="funny") async for video in tag.videos(count=30): print(video) print(video.as_dict)

SET LOGGING LEVEL TO INFO BEFORE POSTING CODE OUTPUT

import logging
TikTokApi(logging_level=logging.INFO) # SETS LOGGING_LEVEL TO INFO
# Hopefully the info level will help you debug or at least someone else on the issue
ketanmalempati commented 1 year ago

Hey is your code working? I am getting TypeError: TikTokException.init() missing 2 required positional arguments: 'raw_response' and 'message' Any idea of how to solve it?

claire-yiting-zhang commented 1 year ago

Hey is your code working? I am getting TypeError: TikTokException.init() missing 2 required positional arguments: 'raw_response' and 'message' Any idea of how to solve it?

I am getting the same error. TikTok has updated its website recently, so the API doesn't work anymore. I am also waiting for solutions.

ketanmalempati commented 1 year ago

Okay got it. Thank you. Any idea of other apis for Tiktok?

claire-yiting-zhang commented 1 year ago

Okay got it. Thank you. Any idea of other apis for Tiktok?

Not rly