{"id":42835289,"url":"https://github.com/sshwy/pku3b","last_synced_at":"2026-01-30T11:40:57.340Z","repository":{"id":281015400,"uuid":"943931578","full_name":"sshwy/pku3b","owner":"sshwy","description":"🎓a Better BlackBoard for PKUers. 北京大学教学网命令行工具（🖥️Win/🐧Linux/🍏Mac）, 支持查看/提交作业、下载课程回放.","archived":false,"fork":false,"pushed_at":"2025-09-11T03:39:16.000Z","size":12459,"stargazers_count":56,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-18T08:11:23.604Z","etag":null,"topics":["blackboard-learn","cli","command-line-tool","crawler","m3u8","peking-university","pku","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshwy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-06T14:01:45.000Z","updated_at":"2025-10-09T15:19:49.000Z","dependencies_parsed_at":"2025-03-06T14:53:09.120Z","dependency_job_id":"11df38ff-2f79-484c-ac83-4a7364c8186e","html_url":"https://github.com/sshwy/pku3b","commit_stats":null,"previous_names":["sshwy/pku3b"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/sshwy/pku3b","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshwy%2Fpku3b","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshwy%2Fpku3b/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshwy%2Fpku3b/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshwy%2Fpku3b/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshwy","download_url":"https://codeload.github.com/sshwy/pku3b/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshwy%2Fpku3b/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28911865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T08:15:08.179Z","status":"ssl_error","status_checked_at":"2026-01-30T08:14:31.507Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blackboard-learn","cli","command-line-tool","crawler","m3u8","peking-university","pku","rust"],"created_at":"2026-01-30T11:40:57.273Z","updated_at":"2026-01-30T11:40:57.334Z","avatar_url":"https://github.com/sshwy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PKU3b: A Better Black Board for PKUers 🎓\n\n[![Crates.io](https://img.shields.io/crates/v/pku3b)](https://crates.io/crates/pku3b)\n![Issues](https://img.shields.io/github/issues-search?query=repo%3Asshwy%2Fpku3b%20is%3Aopen\u0026label=issues\u0026color=orange)\n![Closed Issues](https://img.shields.io/github/issues-search?query=repo%3Asshwy%2Fpku3b%20is%3Aclosed\u0026label=closed%20issues\u0026color=green)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sshwy/pku3b/build-release.yml)\n![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/sshwy/pku3b/total)\n\n如果这个项目为你带来了便利，不妨给个 star ⭐ 支持一下～\n\npku3b 是一个由 Rust 实现的小巧 (~10MB) 命令行工具，用于爬取北京大学教学网 (\u003chttps://course.pku.edu.cn\u003e) 的信息。目前它可以\n\n- 📋 查看课程作业信息（未完成/全部）\n- 📂 下载课程作业附件\n- 📤 提交课程作业\n- 🎥 查看课程回放列表\n- ⏯️ 下载课程回放（需要 ffmpeg）\n- 🎓 快捷选课（你懂我什么意思吧）\n- 📱 Bark 通知推送（可选，用于选课成功通知）\n\n基本用法如下：\n\n```text\nA tool for PKU students to check their courses.\n\nUsage: pku3b [COMMAND]\n\nCommands:\n  assignment  获取课程作业信息/下载附件/提交作业 [aliases: a]\n  video       获取课程回放/下载课程回放 [aliases: v]\n  syllabus    选课操作 [aliases: s]\n  ttshitu     图形验证码识别 [aliases: tt]\n  bark        Bark通知设置 [aliases: b]\n  init        (重新) 初始化用户名/密码\n  config      显示或修改配置项\n  cache       查看缓存大小/清除缓存\n  help        Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help (see more with '--help')\n  -V, --version  Print version\n```\n\n## 【新增】选课操作流程\n\n```bash\npku3b ttshitu init # 初始化 TT 识图账号密码\npku3b ttshitu test # 测试一下是否配置成功\npku3b bark init # 【可选】初始化 Bark 通知令牌，用于选课成功通知\npku3b bark test # 【可选】测试 Bark 通知是否配置成功\npku3b s set # 交互式选择课程并加入快捷选课列表\npku3b s unset # 交互式选择课程并移除快捷选课列表\npku3b config # 通过查看配置来查看快捷选课列表\npku3b s launch # 启动快捷选课循环（如配置了 Bark 会自动发送通知）\n```\n\n### Bark 通知功能 📱\n\npku3b 支持通过 [Bark](https://apps.apple.com/cn/app/bark-customed-notifications/id1403753865) 发送选课通知到 iPhone/iPad：\n\n- **选课开始通知**: 自动选课程序启动时发送\n- **选课成功通知**: 成功选上课程时发送\n- **登录失败通知**: 无法登录选课网时发送\n- **选课循环中断通知**: 选课过程中出现异常时发送\n\n配置步骤：\n\n1. 在 App Store 下载 Bark 应用\n2. 获取你的 Bark 推送令牌\n3. 执行 `pku3b bark init` 配置令牌\n4. 执行 `pku3b bark test` 测试通知功能\n\n**注意：Bark 通知是完全可选的功能，不配置也不会影响选课程序的正常运行。**\n\n## Demo 🎬\n\n查看作业/下载附件:\n\n![demo-a](assets/demo-pku3b-a.gif)\n\n查看/下载课程回放，支持断点续传 (10 倍速):\n\n![demo-v](assets/demo-pku3b-v.gif)\n\n## Getting Started 🚀\n\n### [1/3] Install `pku3b`\n\n首先你需要安装 `pku3b` 本身。**在安装完成后请重新开一个终端窗口，否则会找不到该命令**。\n\n#### Build from Source\n\n这个安装方式在 Win/Linux/Mac 上均适用。\n\n如果你的电脑上恰好有 rust 工具链，那么建议你使用 cargo 安装最新版本。如果需要更新，只需再次执行这个命令：\n\n```bash\ncargo install pku3b\n```\n\n#### Windows 🖥️\n\n对于 Windows 系统，你可以在终端（Powershell/Terminal）执行命令来安装 pku3b。首先你可以执行以下命令来确保终端可以访问 Github。如果该命令输出 `200`，说明成功:\n\n```powershell\n(Invoke-WebRequest -Uri \"https://github.com/sshwy/pku3b\" -Method Head).StatusCode\n```\n\n为了保证你能够执行远程下载的批处理脚本，你需要暂时关闭【Windows 安全中心 \u003e 病毒和威胁防护 \u003e 管理设置 \u003e 实时保护】，然后执行以下命令（直接复制全部文本粘贴至命令行）来安装指定版本的 pku3b (当前最新版 `0.10.1`):\n\n```powershell\nInvoke-WebRequest `\n  -Uri \"https://raw.githubusercontent.com/sshwy/pku3b/refs/heads/master/assets/windows_install.bat\" `\n  -OutFile \"$env:TEMP\\script.bat\"; `\nStart-Process `\n  -FilePath \"$env:TEMP\\script.bat\" `\n  -ArgumentList \"0.10.1\" `\n  -NoNewWindow -Wait\n```\n\n安装过程大致如下:\n\n```powershell\nStep 1: Downloading pku3b version 0.10.1...\nDownload complete.\nStep 2: Extracting pku3b version 0.10.1...\nExtraction complete.\nStep 3: Moving pku3b.exe to C:\\Users\\Sshwy\\AppData\\Local\\pku3b\\bin...\n移动了         1 个文件。\nFile moved to C:\\Users\\Sshwy\\AppData\\Local\\pku3b\\bin.\nStep 4: Checking if C:\\Users\\Sshwy\\AppData\\Local\\pku3b\\bin is in the PATH variable...\nC:\\Users\\Sshwy\\AppData\\Local\\pku3b\\bin is already in the PATH variable.\nInstallation complete!\n请按任意键继续. . .\n```\n\n#### MacOS 🍏\n\n你可以使用 Homebrew 安装 (你需要保证你的终端可以访问 Github):\n\n```bash\nbrew install sshwy/tools/pku3b\n```\n\n#### Linux 🐧\n\n你可以从 [Release](https://github.com/sshwy/pku3b/releases) 页面中找到你所使用的操作系统对应的版本，然后下载二进制文件，放到应该放的位置，然后设置系统的环境变量。你也可以不设置环境变量，而是直接通过文件路径来执行这个程序。\n\n### [2/3] Install FFmpeg (optional)\n\n如果需要使用下载课程回放的功能，你需要额外安装 `ffmpeg`:\n\n- 在 Windows 🖥️ 上推荐使用 winget 安装: `winget install ffmpeg`。如果您艺高人胆大，也可以手动从官网上下载二进制文件安装，然后将 `ffmpeg` 命令加入系统环境变量。\n- 在 MacOS 🍏 上可以使用 Homebrew 安装: `brew install ffmpeg`；\n- 在 Linux 🐧 上使用发行版的包管理器安装（以 Ubuntu 为例）: `apt install ffmpeg`；\n\n安装完成后请新开一个终端窗口，并执行 `ffmpeg` 命令检查是否安装成功（没有显示“找不到该命令”就说明安装成功）。\n\n### [3/3] Initialization\n\n在首次执行命令前你需要登陆教学网。执行以下命令，根据提示输入教学网账号密码来完成初始化设置（只需要执行一次）：\n\n```bash\npku3b init\n```\n\n完成初始化设置后即可使用该工具啦。如果之后想修改配置，可以使用 `pku3b config -h` 查看帮助。\n\n更多示例:\n\n- 📋 查看未完成的作业列表: `pku3b a ls`\n- 📋 查看全部作业列表: `pku3b a ls -a`\n- 📂 下载作业附件: `pku3b a down \u003cID\u003e`: ID 请在作业列表中查看\n- 📂 交互式下载作业附件: `pku3b a down`: ID 请在作业列表中查看\n- 📤 提交作业: `pku3b a sb \u003cID\u003e \u003cPATH\u003e`: PATH 为文件路径，可以是各种文件，例如 pdf、zip、txt 等等\n- 📤 交互式提交作业: `pku3b a sb`: 会在当前工作目录中寻找要提交的作业\n- 🎥 查看课程回放列表: `pku3b v ls`\n- 🎥 查看所有学期课程回放列表: `pku3b v ls --all-term`\n- ⏯️ 下载课程回放: `pku3b v down \u003cID\u003e`: ID 请在课程回放列表中复制，该命令会将视频转换为 mp4 格式保存在执行命令时所在的目录下（如果要下载历史学期的课程回放，需要使用 `--all-term` 选项）。\n- 📱 初始化 Bark 通知: `pku3b bark init` 或 `pku3b b init`\n- 📱 测试 Bark 通知: `pku3b bark test` 或 `pku3b b test`\n- 🗑️ 查看缓存占用: `pku3b cache`\n- 🗑️ 清空缓存: `pku3b cache clean`\n- ❓ 查看某个命令的使用方法 (以下载课程回放的命令为例): `pku3b help v down`\n- ⚙️ 输出调试日志:\n  - 在 Windows 上：设置终端环境变量（临时）`$env:RUST_LOG = 'info'`，那么在这个终端之后执行的 pku3b 命令都会输出调试日志。\n  - 在 Linux/Mac 上：同样可以设置终端环境变量 `export RUST_LOG=info`；另外一个方法是在执行 pku3b 的命令前面加上 `RUST_LOG=info`，整个命令形如 `RUST_LOG=info pku3b [arguments...]`\n\n## Motivation 💡\n\n众所周知 PKU 的教学网 UI 长得非常次时代，信息获取效率奇低。对此已有的解决方案是借助 [PKU-Art](https://github.com/zhuozhiyongde/PKU-Art) 把 UI 变得赏心悦目一点。\n\n但是如果你和我一样已经进入到早十起不来、签到不想管、不知道每天要上什么课也不想关心、对教学网眼不见为净的状态，那我猜你至少会关注作业的 DDL，或者期末的时候看看回放。于是 `pku3b` 应运而生。在开发项目的过程中又有了更多想法，于是功能就逐渐增加了。\n\n其他同学在本项目基础上新增了更多爬取功能，打包成python库和MCP server，未来这些功能会合并至本项目，如果感兴趣的可以访问：[pku3b_AI](https://github.com/JKay15/pku3b_AI)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshwy%2Fpku3b","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshwy%2Fpku3b","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshwy%2Fpku3b/lists"}