# Chaoxing Ppt Downloader

> Download PPT or PPTX courseware from Chaoxing course pages with Playwright. Use when a user asks to save Chaoxing courseware, PPT files, or chapter documents from `mooc1.chaoxing.com` to a local folder, especially when the files are embedded behind `pan-yz.chaoxing.com` preview frames and require a logged-in browser session.

- Skill: `alanless123/chaoxing-ppt-downloader` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add alanless123/chaoxing-ppt-downloader`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alanless123/chaoxing-ppt-downloader/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: Alanless123 (https://skillmd.com/u/alanless123)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alanless123/chaoxing-ppt-downloader

---


# Chaoxing PPT Downloader

Use this skill for Chaoxing course pages where the visible chapter page is not the real file URL.

The reliable path is:

1. Open the course page with Playwright in a persistent Chrome context.
2. Reuse an authenticated session or let the user log in once in the Playwright-opened Chrome window.
3. Wait for `pan-yz.chaoxing.com/screen/v2/file_*` frames to load.
4. Read each frame for:
   - `#fileInfoNameInput`
   - the embedded `'download': 'https://d0.cldisk.com/download/...'` URL
5. Download the file with Playwright request context and these headers:
   - `referer: <frame url>`
   - `origin: https://pan-yz.chaoxing.com`
   - `sec-fetch-site: cross-site`
   - `sec-fetch-mode: navigate`
   - `sec-fetch-dest: document`
   - `upgrade-insecure-requests: 1`

## Workflow

### 1. Prepare the target folder

Create the destination directory first.

Example:

```powershell
New-Item -ItemType Directory -Force -Path "D:\target\ppt" | Out-Null
```

### 2. Run the bundled script

Use the script in [`scripts/download_chaoxing_ppt.js`](C:\Users\Lenovo\.codex\skills\chaoxing-ppt-downloader\scripts\download_chaoxing_ppt.js).

Example:

```powershell
node "C:\Users\Lenovo\.codex\skills\chaoxing-ppt-downloader\scripts\download_chaoxing_ppt.js" `
  --url "https://mooc1.chaoxing.com/mycourse/studentstudy?chapterId=..." `
  --out "D:\target\ppt"
```

Behavior:

- Launch Chrome via Playwright using a persistent profile under `%TEMP%`.
- If the page redirects to `passport2.chaoxing.com/login`, keep the browser open and wait for login.
- Extract all unique PPT/PPTX/PDF-style file frames.
- Save files to the requested directory.

### 3. Verify outputs

List the directory and confirm filenames and sizes.

Example:

```powershell
Get-ChildItem "D:\target\ppt" | Select-Object Name, Length, LastWriteTime
```

## Important Notes

- Do not trust the visible course page URL as the file URL.
- The real file URL is usually a signed `d0.cldisk.com/download/...` link embedded in the `pan-yz` preview frame.
- Those signed links can expire. If reusing later fails, rerun the extraction flow instead of reusing an old `download` URL.
- `page.request.get()` may return `403` unless the request includes the correct `referer` and `origin`.
- If the user says they are already logged in in their normal Chrome, that still may not help unless Playwright is using the same authenticated context or the user logs in once in the Playwright-opened Chrome window.

## Troubleshooting

### Login page keeps appearing

- Keep the Playwright Chrome window open.
- Ask the user to log in there once.
- Reuse the same persistent profile on the next run.

### Direct file download returns `403`

- Re-extract the fresh `download` URL from the frame.
- Send the request with the `pan-yz` frame URL as `referer`.

### No `pan-yz` frames found

- Wait longer after the chapter page loads.
- Confirm the chapter really contains PPT/PPTX/PDF courseware instead of video-only content.

## Output

Report:

- the destination directory
- the downloaded filenames
- any files that failed and why

