From c3f8db7bb478175660ae2c8afc11bd337fd7576e Mon Sep 17 00:00:00 2001 From: iamzhz Date: Tue, 20 Aug 2024 19:12:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E6=B7=BB=E6=94=AF=E6=8C=81=E5=AF=B9'?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=80=A7=E4=BD=9C=E4=B8=9A'=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tchMaterial-parser.pyw | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tchMaterial-parser.pyw b/src/tchMaterial-parser.pyw index b48c7cf..5f4f228 100644 --- a/src/tchMaterial-parser.pyw +++ b/src/tchMaterial-parser.pyw @@ -58,7 +58,10 @@ def parse(url): # 解析 URL } """ # 其中 $.ti_items 的每一项对应一个电子课本 - response = requests.get(f"https://s-file-1.ykt.cbern.com.cn/zxx/ndrv2/resources/tch_material/details/{contentId}.json", proxies={ "http": None, "https": None }) + if "syncClassroom/basicWork/detail" in url: # 对于“基础性作业”的解析 + response = requests.get(f"https://s-file-1.ykt.cbern.com.cn/zxx/ndrs/special_edu/resources/details/{contentId}.json", proxies={ "http": None, "https": None }) + else: # 对于课本的解析 + response = requests.get(f"https://s-file-1.ykt.cbern.com.cn/zxx/ndrv2/resources/tch_material/details/{contentId}.json", proxies={ "http": None, "https": None }) data = json.loads(response.text) for item in list(data["ti_items"]): if item["lc_ti_format"] == "pdf": # 找到存有 PDF 链接列表的项