Sam0230 / abook-downloader

一个用于在高等教育出版社的Abook网站上下载课程资源的小工具
The Unlicense
67 stars 12 forks source link

一个用于在高等教育出版社的Abook网站上下载课程资源的小工具

使用Node.js编写,依赖progress、request、string-width、performance-now模块。

abook-downloader.js是源代码,abook-downloader.bundle.min.js是打包好的bundle,可独立运行。packer.sh是打包器。

使用方法

先去https://github.com/Sam0230/abook-downloader/releases 下载你的电脑对应的版本:
M1 Mac上的macOS:      macOS on Apple Silicon.zip
Intel CPU的Mac上的macOS:   macOS on Intel CPU.zip
大部分Windows:         Windows on x86-64 CPU.zip
M1 Mac上虚拟机里的Windows:    virtualized Windows on Mac with Apple Silicon.zip
Linux:              abook-downloader.bundle.min.js
sam0230@Sam0230-macOS:~$ /Users/sam0230/Downloads/macOS.on.Apple.Silicon/launch-mac-arm64.sh    (解压,然后Windows用户双击打开launch-windows-XXX.bat,macOS用户打开终端,把launch-mac-XXX.sh拖进去,再按回车键。Linux用户用包管理器安装Node.js,然后node abook-downloader.bundle.min.js)
Username: Sam0230   (输如你的用户名,回车)
Password: XXXXXXXX  (密码)
login().
login() succeeded.
Fetching course list.
Successfully fetched course list.
There are 3 course(s) available:
0 5000003017 有机化学(第六版)
1 5000003391 无机化学(第四版)
2 5000003478 普通化学(第七版)
Course number / ID, or R to reload, A to download all, Q to quit: 2 (你想下载的课程前面的数字,或R来刷新列表,A来下载全部,Q来退出)
Fetching resource structure.
Successfully fetched resource structure.
Fetching download links.
Successfully fetched download links.
Resource structure of cource 5000003478:
{
    "name": "root",
    "id": 0,            (注意这里)
    "children": [
        {
            "name": "课程介绍",
            "id": 5000360653,
            "children": []
        },
        {
            "name": "电子教案",
            "id": 5000360654,           (注意这里)
            "children": [
                {
                    "name": "绪论、第一章",
                    "id": 5000360661,
                    "children": []
                },
                {
                    "name": "第二章",
                    "id": 5000360662,
                    "children": []
                },
                {
                    "name": "第三章",
                    "id": 5000360663,
                    "children": []
                },
                {
                    "name": "第四章",
                    "id": 5000360664,
                    "children": []
                },
                {
                    "name": "第五章",
                    "id": 5000360665,
                    "children": []
                },
                {
                    "name": "第六章",
                    "id": 5000360666,
                    "children": []
                },
                {
                    "name": "第七章",
                    "id": 5000360667,
                    "children": []
                },
                {
                    "name": "第八章",
                    "id": 5000360668,
                    "children": []
                },
                {
                    "name": "第九章",
                    "id": 5000360669,
                    "children": []
                }
            ]
        },
        {
            "name": "重难点习题讲解",
            "id": 5000360655,           (注意这里)
            "children": [
                {
                    "name": "1. 化学热力学",
                    "id": 5000360670,
                    "children": [
                        {
                            "name": "试题1",
                            "id": 5000360671,
                            "children": []
                        },
                        {
                            "name": "试题2",
                            "id": 5000360678,
                            "children": []
                        },
                        {
                            "name": "试题3",
                            "id": 5000360680,
                            "children": []
                        },
                        {
                            "name": "试题4",
                            "id": 5000360681,
                            "children": []
                        },
                        {
                            "name": "试题5",
                            "id": 5000360691,
                            "children": []
                        },
                        {
                            "name": "试题6",
                            "id": 5000360692,
                            "children": []
                        },
                        {
                            "name": "试题7",
                            "id": 5000360693,
                            "children": []
                        },
                        {
                            "name": "试题8",
                            "id": 5000360694,
                            "children": []
                        },
                        {
                            "name": "试题9",
                            "id": 5000360695,
                            "children": []
                        },
                        {
                            "name": "试题10",
                            "id": 5000360696,
                            "children": []
                        },
                        {
                            "name": "试题11",
                            "id": 5000360697,
                            "children": []
                        },
                        {
                            "name": "试题12",
                            "id": 5000360698,
                            "children": []
                        },
                        {
                            "name": "试题13",
                            "id": 5000360699,
                            "children": []
                        },
                        {
                            "name": "试题14",
                            "id": 5000360700,
                            "children": []
                        },
                        {
                            "name": "试题15",
                            "id": 5000360701,
                            "children": []
                        },
                        {
                            "name": "试题16",
                            "id": 5000360702,
                            "children": []
                        },
                        {
                            "name": "试题17",
                            "id": 5000360703,
                            "children": []
                        },
                        {
                            "name": "试题18",
                            "id": 5000360704,
                            "children": []
                        },
                        {
                            "name": "试题19",
                            "id": 5000360705,
                            "children": []
                        },
                        {
                            "name": "试题20",
                            "id": 5000360706,
                            "children": []
                        },
                        {
                            "name": "试题21",
                            "id": 5000360707,
                            "children": []
                        },
                        {
                            "name": "试题22",
                            "id": 5000360708,
                            "children": []
                        },
                        {
                            "name": "试题46",
                            "id": 5000360731,
                            "children": []
                        },
                        {
                            "name": "试题48",
                            "id": 5000360733,
                            "children": []
                        }
                    ]
                },
                {
                    "name": "2. 电化学",
                    "id": 5000360672,
                    "children": [
                        {
                            "name": "试题23",
                            "id": 5000360673,
                            "children": []
                        },
                        {
                            "name": "试题24",
                            "id": 5000360709,
                            "children": []
                        },
                        {
                            "name": "试题25",
                            "id": 5000360710,
                            "children": []
                        },
                        {
                            "name": "试题26",
                            "id": 5000360711,
                            "children": []
                        },
                        {
                            "name": "试题27",
                            "id": 5000360712,
                            "children": []
                        },
                        {
                            "name": "试题28",
                            "id": 5000360713,
                            "children": []
                        },
                        {
                            "name": "试题29",
                            "id": 5000360714,
                            "children": []
                        },
                        {
                            "name": "试题30",
                            "id": 5000360715,
                            "children": []
                        },
                        {
                            "name": "试题31",
                            "id": 5000360716,
                            "children": []
                        },
                        {
                            "name": "试题32",
                            "id": 5000360717,
                            "children": []
                        },
                        {
                            "name": "试题49",
                            "id": 5000360734,
                            "children": []
                        }
                    ]
                },
                {
                    "name": "3. 化学动力学",
                    "id": 5000360674,
                    "children": [
                        {
                            "name": "试题33",
                            "id": 5000360675,
                            "children": []
                        },
                        {
                            "name": "试题34",
                            "id": 5000360718,
                            "children": []
                        },
                        {
                            "name": "试题35",
                            "id": 5000360719,
                            "children": []
                        },
                        {
                            "name": "试题36",
                            "id": 5000360720,
                            "children": []
                        },
                        {
                            "name": "试题37",
                            "id": 5000360721,
                            "children": []
                        },
                        {
                            "name": "试题38",
                            "id": 5000360722,
                            "children": []
                        },
                        {
                            "name": "试题39",
                            "id": 5000360723,
                            "children": []
                        },
                        {
                            "name": "试题40",
                            "id": 5000360724,
                            "children": []
                        }
                    ]
                },
                {
                    "name": "4. 配位化学",
                    "id": 5000360676,
                    "children": [
                        {
                            "name": "试题41",
                            "id": 5000360677,
                            "children": []
                        },
                        {
                            "name": "试题42",
                            "id": 5000360725,
                            "children": []
                        },
                        {
                            "name": "试题43",
                            "id": 5000360726,
                            "children": []
                        },
                        {
                            "name": "试题44",
                            "id": 5000360727,
                            "children": []
                        }
                    ]
                },
                {
                    "name": "5. 其他",
                    "id": 5000360729,
                    "children": [
                        {
                            "name": "试题45",
                            "id": 5000360730,
                            "children": []
                        },
                        {
                            "name": "试题47",
                            "id": 5000360732,
                            "children": []
                        },
                        {
                            "name": "试题50",
                            "id": 5000360735,
                            "children": []
                        }
                    ]
                }
            ]
        },
        {
            "name": "拓展知识",
            "id": 5000360656,
            "children": [
                {
                    "name": "1.手性药物",
                    "id": 5000360657,
                    "children": []
                },
                {
                    "name": "2.拆分原理",
                    "id": 5000360658,
                    "children": []
                },
                {
                    "name": "3.扁桃酸",
                    "id": 5000360659,
                    "children": []
                }
            ]
        }
    ]
}
The ID of the resource / resource tree to download, or R to return:     (你要下载的部分的ID,比如,你想下载电子教案,就输入5000360654,就是上面电子教案那一栏里的ID,而重难点习题讲解的就是5000360655,0是下载全部)
Fetching resource information.
Successfully fetched resource information.
Downloader (Built-in - default, Aria2, cUrl, Cancel): b         (b是内建下载器,a是aria2,u是curl,c是取消)
Downloading AbookDownloads/普通化学(第七版)/电子教案/绪论、第一章/绪论+第1章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第二章/第2章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第三章/第3章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第四章/第4章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第五章/第5章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第六章/第6章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第七章/第7章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第八章/第8章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/电子教案/第九章/第9章.pptx .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题1/1热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题2/2热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题3/3热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题4/4热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题5/5热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题6/6热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题7/7热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题8/8热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题9/9热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题10/10热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题11/11热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题12/12热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题13/13热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题14/14热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题15/15热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题16/16热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题17/17热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题18/18热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题19/19热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题20/20热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题21/21热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题22/22热题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题46/46概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/1. 化学热力学/试题48/48概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题23/23电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题24/24电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题25/25电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题26/26电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题27/27电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题28/28电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题29/29电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题30/30电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题31/31电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题32/32电题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/2. 电化学/试题49/49概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题33/33动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题34/34动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题35/35动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题36/36动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题37/37动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题38/38动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题39/39动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/3. 化学动力学/试题40/40动题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/4. 配位化学/试题41/41配题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/4. 配位化学/试题42/42配题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/4. 配位化学/试题43/43配题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/4. 配位化学/试题44/44配题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/5. 其他/试题45/45概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/5. 其他/试题47/47概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/重难点习题讲解/5. 其他/试题50/50概题.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/拓展知识/1.手性药物/19手性药物.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/拓展知识/2.拆分原理/20拆分原理.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
Downloading AbookDownloads/普通化学(第七版)/拓展知识/3.扁桃酸/21扁桃酸.mp4 .
[=================================================================] 100.00 %   X.XX MB/s
There are 3 course(s) available:
0 5000003017 有机化学(第六版)
1 5000003391 无机化学(第四版)
2 5000003478 普通化学(第七版)
Course number / ID, or R to reload, A to download all, Q to quit: q
sam0230@Sam0230-macOS:~$