36 lines
876 B
Python
36 lines
876 B
Python
"""PyInstaller 打包入口(方案 C:免安装 Python)。"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def _prepare_cwd() -> None:
|
|
if getattr(sys, "frozen", False):
|
|
os.chdir(os.path.dirname(sys.executable))
|
|
|
|
|
|
def main() -> None:
|
|
_prepare_cwd()
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] in ("--install-browser", "--fix-browser"):
|
|
from douyin_collector_bootstrap import install_chromium, scrub_playwright_env
|
|
|
|
target = scrub_playwright_env()
|
|
install_chromium(target)
|
|
from douyin_collector_bootstrap import resolve_chrome_exe
|
|
|
|
print("OK:", resolve_chrome_exe())
|
|
input("\n按回车退出…")
|
|
return
|
|
|
|
from douyin_collector_bootstrap import ensure_browser_ready
|
|
import collector_main
|
|
|
|
ensure_browser_ready()
|
|
collector_main.main()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|