Skip to content

Commit 1579d5f

Browse files
authored
[Bugfix] RuntimeError: There is no current event loop in thread
``` RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0' TRACEBACK: Traceback (most recent call last): ... File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/TikTokAPI/tiktokapi.py", line 239, in downloadVideoById video_info = self.getVideoById(video_id) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/TikTokAPI/tiktokapi.py", line 236, in getVideoById return self.send_get_request(url, params) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/TikTokAPI/tiktokapi.py", line 74, in send_get_request signature = self.tiktok_browser.fetch_auth_params(url, language=self.language) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/events.py", line 656, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' ```
1 parent 86ab7ca commit 1579d5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

TikTokAPI/tiktok_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, user_agent):
5151
self.tiktok_dummy_page = "file://" + os.path.join(parent_folder, "website", "tiktok.html")
5252

5353
def fetch_auth_params(self, url, language='en'):
54-
return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))
54+
return asyncio.new_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))
5555

5656
async def async_fetch_auth_params(self, url, language):
5757
browser = await launch(self.options)

0 commit comments

Comments
 (0)