avilash / TikTokAPI-Python

TikTok API Python Wrapper
http://avilashkumar.com/TikTokAPI-Python/
MIT License
443 stars 114 forks source link

RuntimeError: There is no current event loop in thread 'Handler_0'. #13

Open JustPieceOfMeat opened 3 years ago

JustPieceOfMeat commented 3 years ago

Tried

api = TikTokAPI()
video = api.getVideoById('6896523341402737921')
print(video)

got

There is no current event loop in thread 'Handler_0'.
Traceback (most recent call last):
  File "C:\Users\JustP\Documents\GitHub\pyrogram_plugins\venv\lib\site-packages\pyrogram\dispatcher.py", line 210, in handler_worker
    await self.loop.run_in_executor(
  File "C:\Python39\lib\concurrent\futures\thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\JustP\Documents\GitHub\pyrogram_plugins\plugins\tiktok.py", line 9, in tiktok
    video = api.getVideoById('6896523341402737921')
  File "C:\Users\JustP\Documents\GitHub\pyrogram_plugins\venv\lib\site-packages\TikTokAPI\tiktokapi.py", line 224, in getVideoById
    return self.send_get_request(url, params)
  File "C:\Users\JustP\Documents\GitHub\pyrogram_plugins\venv\lib\site-packages\TikTokAPI\tiktokapi.py", line 65, in send_get_request
    signature = self.tiktok_browser.fetch_auth_params(url, language=self.language)
  File "C:\Users\JustP\Documents\GitHub\pyrogram_plugins\venv\lib\site-packages\TikTokAPI\tiktok_browser.py", line 54, in fetch_auth_params
    return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))
  File "C:\Python39\lib\asyncio\events.py", line 642, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'Handler_0'.

Same error I have in WSL2 Also tried video = api.getVideoById(6896523341402737921), but it doesn't help

benjaminu commented 2 years ago

Was this ever resolved?