diff --git a/README.md b/README.md index 8ce2a36..116a29f 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,21 @@ run thu-learn-downloader-windows-x86_64.exe in cmd or powershell. ## exe packing - -- run in project root: +- run in project root: +- please install playwright directly in venv using: +```powershell +$env:PLAYWRIGHT_BROWSERS_PATH="0" +playwright install chromium +``` +(please refer to:https://playwright.dev/python/docs/library#pyinstaller) +then: +```powershell .\.venv\Scripts\pyinstaller.exe --onefile --clean --add-data "thu_learn_downloader/openssl.conf;thu_learn_downloader" .\thu_learn_downloader\main.py --runtime-hook .\thu_learn_downloader\hook.py +``` +## exe recommended usage +```powershell +.\thu-learn-downloader-windows-x86_64.exe -u [USERNAME] -p [PASSWORD] -s [SEMESTER] +``` +NOTICE THAT PASSWORD WILL NOT BE REDACTED!!! + +then complete 2FA in prompted browser panel. \ No newline at end of file diff --git a/thu_learn_downloader/client/learn.py b/thu_learn_downloader/client/learn.py index 8cead89..0f03b13 100644 --- a/thu_learn_downloader/client/learn.py +++ b/thu_learn_downloader/client/learn.py @@ -1,15 +1,13 @@ import functools import re -from playwright.sync_api import sync_playwright -from requests.cookies import RequestsCookieJar from collections.abc import Sequence -from urllib.parse import ParseResult from bs4 import BeautifulSoup, Tag +from playwright.sync_api import sync_playwright from requests import Response +from requests.cookies import RequestsCookieJar from thu_learn_downloader.common.typing import cast - from . import url from .client import Client, Language from .semester import Semester