Skip to content

Commit

Permalink
增添支持对'基础性作业'的下载
Browse files Browse the repository at this point in the history
  • Loading branch information
iamzhz committed Aug 20, 2024
1 parent bfb230b commit c3f8db7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tchMaterial-parser.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -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 链接列表的项
Expand Down

0 comments on commit c3f8db7

Please sign in to comment.