21 lines
735 B
Python
21 lines
735 B
Python
|
|
# 在文件开头添加以下代码(在原导入语句之前)
|
|||
|
|
import sys
|
|||
|
|
import os
|
|||
|
|
|
|||
|
|
# 获取当前脚本所在目录
|
|||
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|||
|
|
# 项目根目录是当前目录的上一级(因为examples目录和conf.py同级)
|
|||
|
|
project_root = os.path.dirname(current_dir)
|
|||
|
|
# 将项目根目录添加到系统路径
|
|||
|
|
sys.path.append(project_root)
|
|||
|
|
import asyncio
|
|||
|
|
from pathlib import Path
|
|||
|
|
|
|||
|
|
from conf import BASE_DIR
|
|||
|
|
from uploader.tk_uploader.main_chrome import tiktok_setup
|
|||
|
|
|
|||
|
|
if __name__ == '__main__':
|
|||
|
|
account_file = Path(BASE_DIR / "cookies" / "tk_uploader" / "account.json")
|
|||
|
|
account_file.parent.mkdir(exist_ok=True)
|
|||
|
|
cookie_setup = asyncio.run(tiktok_setup(str(account_file), handle=True))
|