get-class-material 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of get-class-material might be problematic. Click here for more details.
- get_class_material-0.2.0/LICENSE +21 -0
- get_class_material-0.2.0/PKG-INFO +499 -0
- get_class_material-0.2.0/README.md +467 -0
- get_class_material-0.2.0/get_class_material.egg-info/PKG-INFO +499 -0
- get_class_material-0.2.0/get_class_material.egg-info/SOURCES.txt +34 -0
- get_class_material-0.2.0/get_class_material.egg-info/dependency_links.txt +1 -0
- get_class_material-0.2.0/get_class_material.egg-info/entry_points.txt +6 -0
- get_class_material-0.2.0/get_class_material.egg-info/requires.txt +7 -0
- get_class_material-0.2.0/get_class_material.egg-info/top_level.txt +1 -0
- get_class_material-0.2.0/ntu_cool_materials/__init__.py +3 -0
- get_class_material-0.2.0/ntu_cool_materials/__main__.py +5 -0
- get_class_material-0.2.0/ntu_cool_materials/announcements.py +88 -0
- get_class_material-0.2.0/ntu_cool_materials/browser_session.py +156 -0
- get_class_material-0.2.0/ntu_cool_materials/canvas_client.py +266 -0
- get_class_material-0.2.0/ntu_cool_materials/cli.py +932 -0
- get_class_material-0.2.0/ntu_cool_materials/cool_video.py +537 -0
- get_class_material-0.2.0/ntu_cool_materials/course_pipeline.py +930 -0
- get_class_material-0.2.0/ntu_cool_materials/doctor.py +414 -0
- get_class_material-0.2.0/ntu_cool_materials/i18n.py +31 -0
- get_class_material-0.2.0/ntu_cool_materials/media_naming.py +125 -0
- get_class_material-0.2.0/ntu_cool_materials/pages.py +45 -0
- get_class_material-0.2.0/ntu_cool_materials/session_client.py +210 -0
- get_class_material-0.2.0/ntu_cool_materials/storage.py +212 -0
- get_class_material-0.2.0/ntu_cool_materials/sync.py +116 -0
- get_class_material-0.2.0/ntu_cool_materials/text_extract.py +20 -0
- get_class_material-0.2.0/ntu_cool_materials/youtube_cookies.py +204 -0
- get_class_material-0.2.0/pyproject.toml +50 -0
- get_class_material-0.2.0/setup.cfg +4 -0
- get_class_material-0.2.0/tests/test_announcements.py +31 -0
- get_class_material-0.2.0/tests/test_browser_session.py +42 -0
- get_class_material-0.2.0/tests/test_canvas_client.py +27 -0
- get_class_material-0.2.0/tests/test_cool_video.py +61 -0
- get_class_material-0.2.0/tests/test_media_naming.py +48 -0
- get_class_material-0.2.0/tests/test_session_client.py +35 -0
- get_class_material-0.2.0/tests/test_storage.py +49 -0
- get_class_material-0.2.0/tests/test_youtube_cookies.py +40 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jabir
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: get-class-material
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: One-command bulk downloader for NTU COOL (Canvas) course materials — PDFs, lecture videos, and Pages.
|
|
5
|
+
Author-email: jabir <jabir95tsai@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jabir95tsai/get_class_material
|
|
8
|
+
Project-URL: Repository, https://github.com/jabir95tsai/get_class_material
|
|
9
|
+
Project-URL: Issues, https://github.com/jabir95tsai/get_class_material/issues
|
|
10
|
+
Keywords: ntu,ntu-cool,canvas,canvas-lms,course-downloader,education,taiwan
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Topic :: Multimedia :: Video
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: requests>=2.31
|
|
26
|
+
Requires-Dist: playwright>=1.45
|
|
27
|
+
Requires-Dist: yt-dlp>=2024.1.1
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: build; extra == "dev"
|
|
30
|
+
Requires-Dist: twine; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# NTU COOL Get Class Material
|
|
34
|
+
|
|
35
|
+
> **一行指令,把 NTU COOL 整門課PDF、上課簡報、上課影片下載下來。**
|
|
36
|
+
|
|
37
|
+
## 如何使用
|
|
38
|
+
|
|
39
|
+
開啟powershell,輸入以下指令:
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
pip install get-class-material
|
|
43
|
+
ntu-cool-gcm
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 這個工具是什麼
|
|
49
|
+
|
|
50
|
+
期中期末考前,你想把整學期的講義跟錄影影片整理一份在本機,丟給 AI 幫你做摘要、複習、出考古題?
|
|
51
|
+
|
|
52
|
+
這個工具會自動:
|
|
53
|
+
|
|
54
|
+
1. 用你自己的台大帳號登入 NTU COOL(只在瀏覽器登入頁輸入密碼,程式不會看到)
|
|
55
|
+
2. 把你選的課程整門搬下來:**PDF 講義、Page 文字內容、YouTube 連結影片、NTU 上課錄影**
|
|
56
|
+
|
|
57
|
+
之後你可以:
|
|
58
|
+
- 直接拖 PDF 到 ChatGPT / Gemini 問問題
|
|
59
|
+
- 把 `.md` 文字貼進 NotebookLM 做筆記
|
|
60
|
+
|
|
61
|
+
## 誰適合用
|
|
62
|
+
|
|
63
|
+
- 台大學生,有自己 NTU COOL 帳號,想要把整門課的教材下載卻不想一個一個檔案手動下載
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 新手使用完整教學
|
|
68
|
+
|
|
69
|
+
### 第 1 步 — 確認你有沒有 Python
|
|
70
|
+
|
|
71
|
+
**Python** 是這個工具運作所需的程式語言環境。
|
|
72
|
+
|
|
73
|
+
打開 PowerShell(往下兩段教怎麼打開),貼上這行按 Enter:
|
|
74
|
+
|
|
75
|
+
```powershell
|
|
76
|
+
python --version
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
如果看到類似 `Python 3.13.x`,而且 **3 後面那個數字 ≥ 11**,就跳到第 3 步。
|
|
80
|
+
|
|
81
|
+
如果看到「找不到」、「無法辨識的指令」,或顯示的版本是 3.10 以下,先做第 2 步。
|
|
82
|
+
|
|
83
|
+
### 第 2 步 — 安裝 Python
|
|
84
|
+
|
|
85
|
+
到 <https://www.python.org/downloads/> 下載最新版,執行安裝程式。
|
|
86
|
+
|
|
87
|
+
> ⚠ **非常重要:** 安裝畫面第一頁的最下面有個小勾選 **「Add Python to PATH」** 或 **「Add python.exe to PATH」**,**請勾起來**。沒勾的話 PowerShell 之後找不到 python,就要重裝。
|
|
88
|
+
|
|
89
|
+
裝完之後**關掉所有 PowerShell 視窗,再開一次新的**(這樣才會吃到新的 PATH 設定)。再跑一次第 1 步確認。
|
|
90
|
+
|
|
91
|
+
### 第 3 步 — 打開 PowerShell
|
|
92
|
+
|
|
93
|
+
**PowerShell** 是 Windows 內建的「黑黑的命令列視窗」。
|
|
94
|
+
|
|
95
|
+
最快的開法:
|
|
96
|
+
|
|
97
|
+
1. 按鍵盤 **`Win` 鍵**(就是有 Windows 標誌那顆)
|
|
98
|
+
2. 直接打 `PowerShell`
|
|
99
|
+
3. 按 Enter
|
|
100
|
+
|
|
101
|
+
或是用滑鼠:**開始選單 → 搜尋 PowerShell → 點開**。
|
|
102
|
+
|
|
103
|
+
開啟後你會看到一個藍色或黑色的視窗,最後一行是類似 `PS C:\Users\你的名字>` 的字。游標在那邊閃。
|
|
104
|
+
|
|
105
|
+
**從現在起,所有「貼上指令」都是貼到這個視窗裡然後按 Enter。**
|
|
106
|
+
|
|
107
|
+
### 第 4 步 — 安裝這個工具
|
|
108
|
+
|
|
109
|
+
在 PowerShell 貼上:
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
pip install get-class-material
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
按 Enter,等它跑完(會看到一堆 `Collecting...`、`Downloading...`、`Installing...`)。最後看到 `Successfully installed ...` 就 OK。
|
|
116
|
+
|
|
117
|
+
> **`pip` 是什麼?** 它是 Python 內建的「套件下載器」。安裝 Python 時會跟著一起裝。如果這行說「找不到 pip」,通常代表 Python 沒裝好或沒勾「Add Python to PATH」,回到第 2 步重裝。
|
|
118
|
+
|
|
119
|
+
### 第 5 步 — 第一次跑工具
|
|
120
|
+
|
|
121
|
+
```powershell
|
|
122
|
+
ntu-cool-gcm
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
第一次跑會花幾分鐘,因為它會幫你裝幾個額外的東西:
|
|
126
|
+
|
|
127
|
+
- **Chromium 瀏覽器**(讓工具能幫你登入,大約 200MB)
|
|
128
|
+
- **ffmpeg**(合併 YouTube 影片用,大約 240MB,Windows 用 `winget` 自動裝)
|
|
129
|
+
- **Node.js**(處理 YouTube 影片用,Windows 用 `winget` 自動裝)
|
|
130
|
+
|
|
131
|
+
> 如果跳出「使用者帳戶控制」要求權限,點「是」(因為 winget 在裝系統工具)。
|
|
132
|
+
|
|
133
|
+
如果你看到 `winget` 不存在,工具會印出手動安裝的指令給你。Windows 11 大多有內建 `winget`。
|
|
134
|
+
|
|
135
|
+
裝完後,工具會跳出一個 **Chromium 瀏覽器視窗**,自動連到 NTU COOL 登入頁。**用平常的學號密碼登入**。
|
|
136
|
+
|
|
137
|
+
> 🔒 **密碼安全提醒:**
|
|
138
|
+
> - 密碼**只**輸入在這個瀏覽器登入頁,跟你平常用 Chrome 登入一樣
|
|
139
|
+
> - 工具本身**從來不會看到密碼**(它只在登入完拿瀏覽器的 cookie)
|
|
140
|
+
> - 不要把密碼貼在 PowerShell、聊天室、或任何其他地方
|
|
141
|
+
|
|
142
|
+
登入完成後,**不要關閉瀏覽器視窗**,工具會自己處理。
|
|
143
|
+
|
|
144
|
+
### 第 6 步 — 選課
|
|
145
|
+
|
|
146
|
+
登入完成後,PowerShell 會列出你的課程,像這樣:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
找到 5 門課程:
|
|
150
|
+
|
|
151
|
+
1) 日文一下 Japanese (Ⅰ) (2)
|
|
152
|
+
2) 作業管理 Operations Management
|
|
153
|
+
3) 音樂、演化與大腦 Music, Evolution and the Brain
|
|
154
|
+
4) 組織行為學 Organizational Behavior
|
|
155
|
+
5) 管理科學模式 Management Science Model
|
|
156
|
+
|
|
157
|
+
選擇課程 (1-5 可空格多選如 "1 3 5", h = 過去課程, a = 下載全部, en = English, q = 離開)
|
|
158
|
+
>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
可以這樣輸入:
|
|
162
|
+
|
|
163
|
+
| 你輸入 | 結果 |
|
|
164
|
+
|---|---|
|
|
165
|
+
| `3` | 下載第 3 門 |
|
|
166
|
+
| `1 3 5` | 一次下載第 1、3、5 門(空格分隔) |
|
|
167
|
+
| `1,2,4` | 也可以用逗號 |
|
|
168
|
+
| `a` | 下載全部 5 門 |
|
|
169
|
+
| `h` | 進入過去學期的選單,選舊課程 |
|
|
170
|
+
| `en` | 切換成英文介面 |
|
|
171
|
+
| `q` | 離開 |
|
|
172
|
+
|
|
173
|
+
按 Enter 後,工具就會開始幫你抓檔案。檔案大的影片會看到進度條:
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
[##########----] 47% 12.3 / 26.1 MB 3-1 演化的證據.mp4
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 第 7 步 — 下載完成
|
|
180
|
+
|
|
181
|
+
跑完會看到:
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
完成。
|
|
185
|
+
PDF: 新增 6、跳過 0、失敗 0
|
|
186
|
+
Page: 新增 3、跳過 0、失敗 0
|
|
187
|
+
YouTube: 新增 7、跳過 0、失敗 0
|
|
188
|
+
上課影片: 新增 4、跳過 0、失敗 0
|
|
189
|
+
|
|
190
|
+
檔案存放位置:
|
|
191
|
+
C:\Users\你\ntu-cool-gcm_material\音樂、演化與大腦 Music, Evolution and the Brain (57544)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**最後那行就是你的檔案放在哪。** 用檔案總管打開就能看到。
|
|
195
|
+
|
|
196
|
+
之後會問你:
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
下一個動作: c = 繼續下載別的 / a = 下載全部 / h = 過去課程 / en = English / q = 離開
|
|
200
|
+
>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
要再下載另一門就 `c`,要結束就 `q`(會自動關閉 PowerShell 視窗)。
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 你會拿到什麼
|
|
208
|
+
|
|
209
|
+
下載到的目錄結構長這樣:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
C:\Users\你\ntu-cool-gcm_material\
|
|
213
|
+
└── 音樂、演化與大腦 Music, Evolution and the Brain (57544)\
|
|
214
|
+
├── course_overview.md ← 這份課程的目錄索引(可以餵給 AI)
|
|
215
|
+
├── week1\
|
|
216
|
+
│ ├── SYLBS_班次1.pdf
|
|
217
|
+
│ └── 1-1 生物音樂學簡介.mp4
|
|
218
|
+
├── week2\
|
|
219
|
+
│ ├── 2-1-1 伊甸園外的生命長河.pdf
|
|
220
|
+
│ └── 2-3-2 緊拉慢唱的妙用.md
|
|
221
|
+
└── week3\
|
|
222
|
+
└── ...
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
- **`.pdf`** — 老師上傳的講義,原始檔
|
|
226
|
+
- **`.md`** — Page 文字內容(VS Code、Typora、Obsidian 都能讀)
|
|
227
|
+
- **`.mp4`** — YouTube 影片 + NTU 上課錄影,都用人看得懂的中文標題
|
|
228
|
+
- **`course_overview.md`** — 整門課的目錄索引,列出每週有什麼、檔案放在哪。**直接拖到 AI 就可以叫它幫你做學習計畫**
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 下載後怎麼給 AI 用
|
|
233
|
+
|
|
234
|
+
### PDF
|
|
235
|
+
直接拖到 ChatGPT、Gemini、Claude 的對話框,然後問:
|
|
236
|
+
- 「幫我整理這份講義的重點」
|
|
237
|
+
- 「出 5 題選擇題」
|
|
238
|
+
- 「這份跟我之前丟的那份有什麼差別?」
|
|
239
|
+
|
|
240
|
+
### Markdown(`.md` 檔)
|
|
241
|
+
- **NotebookLM**: 把整個 `.md` 檔當「來源」上傳,可以一次餵很多份
|
|
242
|
+
- **ChatGPT / Gemini**: 用文字編輯器開,複製貼上即可
|
|
243
|
+
|
|
244
|
+
### 影片(`.mp4`)
|
|
245
|
+
影片本身大多 AI 工具不能直接吃,要先轉成文字:
|
|
246
|
+
- 用 **MacWhisper**(Mac)、**Whisper Desktop**(Windows)、或 OpenAI 線上 Whisper
|
|
247
|
+
- 轉好的逐字稿再丟給 AI 做摘要
|
|
248
|
+
|
|
249
|
+
### 整門課一起
|
|
250
|
+
把整個課程資料夾的 `course_overview.md` 跟幾份重點 PDF 一起拖到 NotebookLM,叫它「根據這些教材幫我做考試重點摘要」。
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 常見任務
|
|
255
|
+
|
|
256
|
+
### 之後再跑一次
|
|
257
|
+
|
|
258
|
+
```powershell
|
|
259
|
+
ntu-cool-gcm
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
只要登入沒過期(通常一兩天內),不用任何額外動作。**已經抓過的檔案會自動跳過,只補新增的**。
|
|
263
|
+
|
|
264
|
+
### 登入過期了
|
|
265
|
+
|
|
266
|
+
```powershell
|
|
267
|
+
ntu-cool-gcm --refresh-session
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
會再開一次瀏覽器讓你重新登入。
|
|
271
|
+
|
|
272
|
+
### 只想下載 PDF,不要影片
|
|
273
|
+
|
|
274
|
+
```powershell
|
|
275
|
+
ntu-cool-gcm --skip-youtube --skip-cool-videos
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
可以混搭:`--skip-pdfs`、`--skip-pages`、`--skip-youtube`、`--skip-cool-videos`。
|
|
279
|
+
|
|
280
|
+
### 換存檔位置
|
|
281
|
+
|
|
282
|
+
```powershell
|
|
283
|
+
ntu-cool-gcm --out D:\我的課程
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
預設是當前目錄底下的 `ntu-cool-gcm_material/`。
|
|
287
|
+
|
|
288
|
+
### 已經知道課程 ID(網址裡的數字)
|
|
289
|
+
|
|
290
|
+
```powershell
|
|
291
|
+
ntu-cool-materials download-course --course-id 57544
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
(例如 `https://cool.ntu.edu.tw/courses/57544` 裡的 `57544`)
|
|
295
|
+
|
|
296
|
+
### 檢查環境是不是都裝好了
|
|
297
|
+
|
|
298
|
+
```powershell
|
|
299
|
+
ntu-cool-materials doctor
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
會列出 Python、瀏覽器、ffmpeg 等等的安裝狀態。
|
|
303
|
+
|
|
304
|
+
如果有缺,加上 `--fix` 嘗試自動修:
|
|
305
|
+
|
|
306
|
+
```powershell
|
|
307
|
+
ntu-cool-materials doctor --fix
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### YouTube 不公開影片下載失敗
|
|
311
|
+
|
|
312
|
+
NTU 老師很多影片是 YouTube「不公開」設定,需要你的 Google 帳號 cookie 才抓得到。第一次設定:
|
|
313
|
+
|
|
314
|
+
```powershell
|
|
315
|
+
youtube-cookies
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
會跳出瀏覽器,**用你平常會看 NTU COOL 影片的那個 Google 帳號登入**,登入完關掉就好。之後再跑 `ntu-cool-gcm` 就抓得到了。
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 常見問題
|
|
323
|
+
|
|
324
|
+
### Q: 輸入 `python --version` 顯示「無法辨識」/「找不到」
|
|
325
|
+
|
|
326
|
+
代表你**還沒裝 Python**,或者**裝的時候沒勾「Add Python to PATH」**。
|
|
327
|
+
|
|
328
|
+
**解法:** 重裝一次,這次記得勾那個選項。然後**關掉 PowerShell 重開**。
|
|
329
|
+
|
|
330
|
+
### Q: 輸入 `pip install get-class-material` 顯示「找不到 pip」
|
|
331
|
+
|
|
332
|
+
跟上一題一樣,通常是 Python 沒裝好。重裝 Python 並勾「Add Python to PATH」。
|
|
333
|
+
|
|
334
|
+
### Q: PowerShell 顯示「無法載入指令碼,因為這個系統上已停用指令碼執行」
|
|
335
|
+
|
|
336
|
+
這是 Windows 的安全設定。打開 PowerShell **以系統管理員身份**(右鍵點 PowerShell 圖示 → 以系統管理員身份執行),貼上:
|
|
337
|
+
|
|
338
|
+
```powershell
|
|
339
|
+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
按 `Y` 確認。然後關掉視窗,正常開一個新的就 OK。
|
|
343
|
+
|
|
344
|
+
### Q: `ntu-cool-gcm` 跑下去說 `winget` 找不到
|
|
345
|
+
|
|
346
|
+
`winget` 是 Windows 11 內建的應用程式安裝工具。Windows 10 比較舊版可能沒有。
|
|
347
|
+
|
|
348
|
+
**解法:** 到 Microsoft Store 搜尋「應用程式安裝程式」(App Installer),點安裝,重開 PowerShell。
|
|
349
|
+
|
|
350
|
+
或者直接手動安裝 ffmpeg 跟 Node.js:
|
|
351
|
+
1. ffmpeg: <https://www.gyan.dev/ffmpeg/builds/>(下載 `ffmpeg-release-essentials.zip`)
|
|
352
|
+
2. Node.js: <https://nodejs.org/>(下載 LTS 版)
|
|
353
|
+
|
|
354
|
+
裝完關掉 PowerShell 重開,再跑 `ntu-cool-gcm`。
|
|
355
|
+
|
|
356
|
+
### Q: NTU COOL 登入過期了
|
|
357
|
+
|
|
358
|
+
```powershell
|
|
359
|
+
ntu-cool-gcm --refresh-session
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
會再開一次瀏覽器讓你重新登入。
|
|
363
|
+
|
|
364
|
+
### Q: YouTube 影片抓不到 / 失敗很多
|
|
365
|
+
|
|
366
|
+
最常見原因:
|
|
367
|
+
|
|
368
|
+
1. **沒設 YouTube cookies** — 跑 `youtube-cookies` 一次
|
|
369
|
+
2. **沒裝 ffmpeg** — 跑 `ntu-cool-materials doctor` 確認
|
|
370
|
+
3. **影片有 DRM 保護** — 罕見但會發生,這種真的抓不下來
|
|
371
|
+
|
|
372
|
+
跑 `ntu-cool-materials doctor` 看有沒有缺東西。
|
|
373
|
+
|
|
374
|
+
### Q: 下載到一半中斷怎麼辦
|
|
375
|
+
|
|
376
|
+
**直接再跑一次 `ntu-cool-gcm`** 即可。
|
|
377
|
+
|
|
378
|
+
- 已下載完的檔案會跳過
|
|
379
|
+
- 大檔影片會從中斷的地方續傳(不用重抓)
|
|
380
|
+
|
|
381
|
+
### Q: 我的檔案到底放在哪
|
|
382
|
+
|
|
383
|
+
預設在你**執行 `ntu-cool-gcm` 時所在的目錄**底下,叫 `ntu-cool-gcm_material/`。
|
|
384
|
+
|
|
385
|
+
如果你在 PowerShell 看到提示是 `PS C:\Users\你>`,那就是 `C:\Users\你\ntu-cool-gcm_material\`。
|
|
386
|
+
|
|
387
|
+
每次跑完工具最後一行也會印「檔案存放位置:」+ 完整路徑。
|
|
388
|
+
|
|
389
|
+
### Q: 可以只抓 PDF 嗎
|
|
390
|
+
|
|
391
|
+
可以:
|
|
392
|
+
|
|
393
|
+
```powershell
|
|
394
|
+
ntu-cool-gcm --skip-pages --skip-youtube --skip-cool-videos
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Q: 可以換輸出資料夾嗎
|
|
398
|
+
|
|
399
|
+
可以:
|
|
400
|
+
|
|
401
|
+
```powershell
|
|
402
|
+
ntu-cool-gcm --out D:\我的課程資料夾
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Q: 影片畫質好像不太好
|
|
406
|
+
|
|
407
|
+
YouTube 影片畫質取決於老師上傳的原檔。多數 NTU 老師上傳的是 **480p**,工具會自動抓最高畫質,所以你看到的就是來源最高解析度。
|
|
408
|
+
|
|
409
|
+
NTU 上課影片(cool-video)畫質維持來源原檔。
|
|
410
|
+
|
|
411
|
+
### Q: 這樣會不會違反版權
|
|
412
|
+
|
|
413
|
+
**這個工具只下載你自己有權限看到的課程教材** — 跟你平常用瀏覽器一個個下載的權限一模一樣,不繞過任何權限系統。
|
|
414
|
+
|
|
415
|
+
但是:
|
|
416
|
+
|
|
417
|
+
- 下載下來的教材**仍然受老師、出版社、原作者的版權保護**
|
|
418
|
+
- **僅限自己學習使用**,不要公開散播、不要上傳到網路、不要分享給校外人士
|
|
419
|
+
- 老師同意才能在合理範圍內分享給同班同學
|
|
420
|
+
|
|
421
|
+
簡單說:**自己讀沒問題,公開散播違法。**
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## 安全與隱私提醒
|
|
426
|
+
|
|
427
|
+
### 密碼
|
|
428
|
+
|
|
429
|
+
- 密碼**只**輸入在工具跳出來的瀏覽器登入頁(就是 NTU COOL 的官方登入頁面)
|
|
430
|
+
- 工具本身**從來不會看到密碼**
|
|
431
|
+
- 不要把密碼複製貼上到 PowerShell、聊天室、Email 或任何其他地方
|
|
432
|
+
|
|
433
|
+
### `.secrets/` 資料夾
|
|
434
|
+
|
|
435
|
+
工具會在你執行的目錄下建一個 `.secrets/` 資料夾,裡面存:
|
|
436
|
+
- 你登入後的 cookie(等同於登入狀態)
|
|
437
|
+
- YouTube 的 cookie
|
|
438
|
+
|
|
439
|
+
**這個資料夾等同於你的登入憑證**。請:
|
|
440
|
+
|
|
441
|
+
- ❌ **不要**分享給別人,連同學也不要
|
|
442
|
+
- ❌ **不要**上傳到 GitHub、雲端硬碟、Discord
|
|
443
|
+
- ❌ **不要**截圖貼到聊天室
|
|
444
|
+
- ✅ 換電腦就重新跑 `ntu-cool-gcm --refresh-session` 重新登入即可
|
|
445
|
+
|
|
446
|
+
預設它是隱藏資料夾(Windows 用 `dir` 看不到,要在檔案總管開「顯示隱藏檔」才看得到)。
|
|
447
|
+
|
|
448
|
+
### 下載的教材
|
|
449
|
+
|
|
450
|
+
不要公開散播。詳見上面的版權問答。
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## 進階:其他指令
|
|
455
|
+
|
|
456
|
+
如果你只想看可見課程清單,不下載:
|
|
457
|
+
|
|
458
|
+
```powershell
|
|
459
|
+
ntu-cool-materials courses --refresh-session
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
抓某課的公告:
|
|
463
|
+
|
|
464
|
+
```powershell
|
|
465
|
+
ntu-cool-materials announcements --course-id 57544 --refresh-session --print
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
完整指令清單請看 `--help`:
|
|
469
|
+
|
|
470
|
+
```powershell
|
|
471
|
+
ntu-cool-materials --help
|
|
472
|
+
ntu-cool-gcm --help
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
<details>
|
|
478
|
+
<summary>給開發者 / 從原始碼安裝</summary>
|
|
479
|
+
|
|
480
|
+
```powershell
|
|
481
|
+
git clone https://github.com/jabir95tsai/get_class_material.git
|
|
482
|
+
cd get_class_material
|
|
483
|
+
pip install -e .
|
|
484
|
+
python -m playwright install chromium
|
|
485
|
+
python -m unittest discover -s tests
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
架構說明見 [CLAUDE.md](CLAUDE.md)。
|
|
489
|
+
|
|
490
|
+
- PyPI: <https://pypi.org/project/get-class-material/>
|
|
491
|
+
- GitHub: <https://github.com/jabir95tsai/get_class_material>
|
|
492
|
+
- License: MIT — 見 [LICENSE](LICENSE)
|
|
493
|
+
|
|
494
|
+
支援的 Python 版本:3.11+。Playwright + yt-dlp + ffmpeg + Node.js 為下載 YouTube 影片所需,工具會在第一次執行時嘗試自動安裝。
|
|
495
|
+
|
|
496
|
+
</details>
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|