Skip to content

Commit

Permalink
Upload 20240914
Browse files Browse the repository at this point in the history
  • Loading branch information
cjhdevact committed Sep 14, 2024
1 parent 3b4b9ac commit 946d279
Show file tree
Hide file tree
Showing 27 changed files with 1,237 additions and 158 deletions.
Binary file modified Assets/MainUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
674 changes: 674 additions & 0 deletions License

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# SmartEduDownloader - 国家中小学智慧教育平台资源解析下载工具

SmartEduDownloader 可以解析下载国家中小学智慧教育平台教材、课程资源地址,支持批量下载,需要.Net Framwork 4.0以上版本支持。

下载地址 [https://gitee.com/cjhdevact/SmartEduDownloader/releases](https://gitee.com/cjhdevact/SmartEduDownloader/releases)

本软件完全免费开源,任何人不得用于商业用途,如果你下载本软件是付费后才可下载的,请立刻举报并反馈。

如果有Bug可以反馈到[这里](https://github.com/cjhdevact/SmartEduDownloader/issues)

程序主页 [https://cjhdevact.github.io/otherprojects/SmartEduDownloader/index.html](https://cjhdevact.github.io/otherprojects/SmartEduDownloader/index.html)

使用教程 [https://cjhdevact.github.io/otherprojects/SmartEduDownloader/Help/index.html](https://cjhdevact.github.io/otherprojects/SmartEduDownloader/Help/index.html)

## 功能说明

本程序支持的功能有:

- [x] 获取智慧教育平台电子教材信息以及下载链接
- [x] 获取智慧教育平台课程资源信息以及下载链接
- [x] 免登录下载智慧教育平台电子教材和课程资源
- [x] 登录下载智慧教育平台电子教材和课程资源
- [x] 自动识别教材标题,自动重命名
- [x] 批量解析和下载智慧教育平台电子教材链接
- [x] 其他一些小工具(如文本处理,批量下载文件(可以使用X-Nd-Auth标头批量下载获取到的教材以及课程资源PDF文件链接)...)
- [x] 100%开源。欢迎提出改进建议。

## 程序截图

![主程序界面](Assets/MainUI.png)


## 开源说明

本软件仅使用了合法的下载技术,本软件自身不存储任何课本资源,课本资源均来自国家的开放平台。

在延伸的代码中(修改和由本仓库代码衍生的代码中)需要说明“基于 SmartEduDownloader( https://github.com/cjhdevact/SmartEduDownloader ) 开发”。


## 此项目使用的API

### 智慧教育平台教材下载

#### 链接格式:

`https://basic.smartedu.cn/tchMaterial/detail?contentType=assets_document&contentId=(教材contentId)&catalogType=tchMaterial&subCatalog=tchMaterial`

#### 解析接口:

动态解析,解析里面的PDF文件和标题,但是要带上X-Nd-Auth标头:
`https://s-file-2.ykt.cbern.com.cn/zxx/ndrv2/resources/tch_material/details/(教材contentId).json`

#### 示例课本网页链接:小学道法一上

`https://basic.smartedu.cn/tchMaterial/detail?contentType=assets_document&contentId=bdc00134-465d-454b-a541-dcd0cec4d86e&catalogType=tchMaterial&subCatalog=tchMaterial`

### 智慧教育平台课程资源下载

#### 链接格式:

教育部资源:

`https://basic.smartedu.cn/syncClassroom/classActivity?activityId=(资源包activityId)&chapterId=&teachingmaterialId=&fromPrepare=0`

学校提供网课:

`https://basic.smartedu.cn/qualityCourse?courseId=(资源包teachingmaterialId)&chapterId=&teachingmaterialId=&fromPrepare=0&classHourId=lesson_1`

备课:

`https://basic.smartedu.cn/syncClassroom/prepare/detail?lessonId=(资源包lessonId)&chapterId=&teachingmaterialId=&fromPrepare=1&classHourId=lesson_1`

#### 解析接口:

动态解析,解析里面的资源文件和标题,但是要带上X-Nd-Auth标头:

教育部资源:

`https://s-file-1.ykt.cbern.com.cn/zxx/ndrv2/national_lesson/resources/details/(资源包activityId).json`

学校提供网课:

`https://s-file-2.ykt.cbern.com.cn/zxx/ndrv2/resources/(资源包teachingmaterialId).json`

备课:

`https://s-file-2.ykt.cbern.com.cn/zxx/ndrv2/prepare_lesson/resources/details/(资源包lessonId).json`

#### 示例网页链接

教育部资源:

`https://basic.smartedu.cn/syncClassroom/classActivity?activityId=f15feef1-b908-44f5-a765-500b9395c313&chapterId=8d6cc118-a169-3ea1-9a45-31cc841ad239&teachingmaterialId=4a4aa279-8dc6-4098-b45f-dd3f7d5a61b2&fromPrepare=0`

学校提供网课:

`https://basic.smartedu.cn/qualityCourse?courseId=8ae7e48f-842c-12fc-0184-35dacdee016f&chapterId=8ae5c0d4-cfd4-34d1-9757-0295bd0c55ed&teachingmaterialId=4a4aa279-8dc6-4098-b45f-dd3f7d5a61b2&fromPrepare=0&classHourId=lesson_1`

备课:

`https://basic.smartedu.cn/syncClassroom/prepare/detail?lessonId=8aee80a5-6b86-5bc9-016b-87465e6e0290&chapterId=5bb731e1-cdac-3984-a977-3d44c5d2d809&teachingmaterialId=4a4aa279-8dc6-4098-b45f-dd3f7d5a61b2&fromPrepare=1&classHourId=lesson_1`

## 致谢

[AnyTextbookDownloader](https://gitlab.com/xiaoyangtech1/AnyTextbookDownloader) - 参考了教材解析思路。

------------


本程序基于 `GPL-3.0` 授权。
73 changes: 47 additions & 26 deletions Src/SmartEduDownloader-Release-InnoSetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9FAF52FE-D96C-4DA1-853D-15D56DE424F8}
AppName=SmartEduDownloader
AppVersion=1.0.2.24091
;AppVerName=SmartEduDownloader 1.0.2.24091
AppVersion=1.0.3.24092
;AppVerName=SmartEduDownloader 1.0.3.24092
AppPublisher=CJH
DefaultDirName={pf}\CJH\SmartEduDownloader\1.0.2.24091
DefaultGroupName=SmartEduDownloader 1.0.2.24091
DefaultDirName={pf}\CJH\SmartEduDownloader\x86
DefaultGroupName=SmartEduDownloader
AllowNoIcons=yes
LicenseFile=..\License
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=.\SmartEduDownloader\setupbin\release
OutputBaseFilename=SmartEduDownloader_1.0.2.24091_x86_setup
OutputBaseFilename=SmartEduDownloader_1.0.3.24092_x86_setup
SetupIconFile=.\SmartEduDownloader\smartedu.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern

VersionInfoCopyright=Copyright © 2024 CJH. All Rights Reserved.
VersionInfoVersion=1.0.2.24091
VersionInfoProductName=SmartEduDownloader 1.0.2.24091
VersionInfoProductVersion=1.0.2.24091
VersionInfoVersion=1.0.3.24092
VersionInfoProductName=SmartEduDownloader 1.0.3.24092
VersionInfoProductVersion=1.0.3.24092
VersionInfoCompany=CJH
VersionInfoDescription=SmartEduDownloader Setup

WizardImageFile=WizModernImage.bmp
WizardSmallImageFile=WizModernSmallImage.bmp

;UninstallDisplayIcon=.\SmartEduDownloader\SmartEduDownloader.ico
UninstallDisplayName=SmartEduDownloader 1.0.2.24091
UninstallDisplayName=SmartEduDownloader 1.0.3.24092

[Languages]
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Expand All @@ -61,18 +61,21 @@ Type: files; Name: "{group}\SmartEduDownloader 1.0.2.24091.lnk"
Type: files; Name: "{commondesktop}\SmartEduDownloader 1.0.2.24091.lnk"
Type: files; Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\SmartEduDownloader 1.0.2.24091.lnk"

[UninstallRun]
Filename: "https://cjhdevact.github.io/otherprojects/SmartEduDownloader/index.html"; Flags: shellexec runmaximized; Tasks: ; Languages:

[Files]
Source: ".\SmartEduDownloader\bin\Release\SmartEduDownloader.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\SmartEduDownloader\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\SmartEduDownloader 1.0.2.24091"; Filename: "{app}\SmartEduDownloader.exe"
Name: "{commondesktop}\SmartEduDownloader 1.0.2.24091"; Filename: "{app}\SmartEduDownloader.exe"; Tasks: desktopicon
Name: "{group}\SmartEduDownloader 教学资源下载器"; Filename: "{app}\SmartEduDownloader.exe"
Name: "{commondesktop}\SmartEduDownloader 教学资源下载器"; Filename: "{app}\SmartEduDownloader.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\SmartEduDownloader.exe"; Description: "{cm:LaunchProgram,SmartEduDownloader}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\SmartEduDownloader.exe"; Parameters: "/unloginmode"; Description: "{cm:LaunchProgram,SmartEduDownloader}"; Flags: nowait postinstall skipifsilent

[Messages]

Expand Down Expand Up @@ -129,7 +132,7 @@ NewFolderName=新建文件夹

; *** “欢迎”向导页
WelcomeLabel1=欢迎安装 SmartEduDownloader!
WelcomeLabel2=现在将安装 SmartEduDownloader 到您的电脑中。%n%n推荐您在继续安装前关闭所有其它应用程序。%n%n编译日期:2024-09-06%n%n版本:1.0.2.24091
WelcomeLabel2=现在将安装 SmartEduDownloader 到您的电脑中。%n%n推荐您在继续安装前关闭所有其它应用程序。%n%n编译日期:2024-09-14%n%n版本:1.0.3.24092

; *** “许可协议”向导页
WizardLicense=许可协议
Expand Down Expand Up @@ -218,8 +221,8 @@ UninstallNotFound=文件“%1”不存在。无法卸载。
UninstallOpenError=文件“%1”不能打开。无法卸载。
UninstallUnsupportedVer=此版本的卸载程序无法识别卸载参数文件“%1”的格式。无法卸载
UninstallUnknownEntry=在卸载日志中遇到一个未知的条目 (%1)
ConfirmUninstall=确定要卸载 SmartEduDownloader
UninstallOnlyOnWin64=这个卸载程序只能在 Windows x64中进行卸载
ConfirmUninstall=确定卸载 SmartEduDownloader 教学资源下载器吗?%n%n卸载之后你将无法快速方便下载教学资源,是否要卸载
UninstallOnlyOnWin64=这个卸载程序只能在 Windows x64 中进行卸载
OnlyAdminCanUninstall=这个卸载程序需要有管理员权限的用户才能卸载。
UninstallStatusLabel=正在从您的电脑中删除 SmartEduDownloader,请稍等。
UninstalledAll=SmartEduDownloader 已从您的电脑中删除。
Expand Down Expand Up @@ -279,10 +282,10 @@ if (IsWin64()) then begin
//自己的appID
SubKeyName := 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{9FAF52FE-D96C-4DA1-853D-15D56DE424F8}_is1';
RegWriteStringValue(HKLM64,SubKeyName,'DisplayName','SmartEduDownloader 1.0.2.24091 (x86)');
RegWriteStringValue(HKLM64,SubKeyName,'DisplayName','SmartEduDownloader 1.0.3.24092 (x86)');
end else begin
SubKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{9FAF52FE-D96C-4DA1-853D-15D56DE424F8}_is1';
RegWriteStringValue(HKLM,SubKeyName,'DisplayName','SmartEduDownloader 1.0.2.24091');
RegWriteStringValue(HKLM,SubKeyName,'DisplayName','SmartEduDownloader 1.0.3.24092');
end;
end;
Expand All @@ -295,6 +298,7 @@ end;
function InitializeSetup(): Boolean;
begin
Result :=true; //安装程序继续
ShellExec('open', ExpandConstant('{cmd}'), '/c taskkill /f /t /im SmartEduDownloader.exe', '', SW_HIDE, ewNoWait, ErrorCode);
IsRunning:=FindWindowByWindowName('SmartEduDownloader');
while IsRunning<>0 do
begin
Expand All @@ -309,10 +313,35 @@ begin
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
SetUninstallIcon(ExpandConstant('{app}\SmartEduDownloader.exe'));
end;
end;
//安装时卸载旧版本
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultStr: String;
ResultCode: Integer;
begin
if CurStep = ssInstall then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9FAF52FE-D96C-4DA1-853D-15D56DE424F8}_is1', 'UninstallString', ResultStr) then
begin
ResultStr := RemoveQuotes(ResultStr);
Exec(ResultStr, '/verysilent /norestart /suppressmsgboxes', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
// 卸载时判断程序是否正在运行
function InitializeUninstall(): Boolean;
begin
Result :=true; //卸载程序继续
Result :=true; //卸载程序继续
ShellExec('open', ExpandConstant('{cmd}'), '/c taskkill /f /t /im SmartEduDownloader.exe', '', SW_HIDE, ewNoWait, ErrorCode);
IsRunning:=FindWindowByWindowName('SmartEduDownloader');
while IsRunning<>0 do
begin
Expand All @@ -325,12 +354,4 @@ begin
IsRunning:=FindWindowByWindowName('SmartEduDownloader');
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
SetUninstallIcon(ExpandConstant('{app}\SmartEduDownloader.exe'));
end;
end;
Loading

0 comments on commit 946d279

Please sign in to comment.