3

我目前正在使用 Discord.py 库创建一个 Discord Bot。机器人的任务之一是使用其他 API 来检查最新的 Youtube 视频、TikTok 等。为了解析 Tiktok 内容,我使用的是TikTokApi。我的 discord bot 客户端中有一个计划任务,该任务将每 5 分钟运行一次:

def check_toks():
es_link = tktok.Tktok_catcher("ES")
en_link = tktok.Tktok_catcher("US")
print(es_link, en_link)

@tasks.loop(minutes=5)
async def check_platforms():
    es_link = tktok.Tktok_catcher("ES")

运行以下代码会给我以下错误:

playwright._impl._api_types.Error: It looks like you are using Playwright Sync API inside the asyncio loop. 
Please use the Async API instead.

是否有解决此问题的方法(一种在 Asyncio 循环内运行 playwright 同步 API 的方法),或者我需要在我使用的库中进行更改以使其正常工作?

4

0 回答 0