{"id":16654166,"url":"https://github.com/letmefly666/yuketangautoplayer","last_synced_at":"2025-11-10T09:04:19.427Z","repository":{"id":196340293,"uuid":"695088298","full_name":"LetMeFly666/YuketangAutoPlayer","owner":"LetMeFly666","description":"雨课堂刷课脚本（雨课堂视频自动播放），基于浏览器模拟的方式运行，无需虚拟机，甚至可以以无窗口模式运行（MOOC）","archived":false,"fork":false,"pushed_at":"2025-10-22T08:31:33.000Z","size":622,"stargazers_count":85,"open_issues_count":2,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T10:23:17.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LetMeFly666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-09-22T10:25:40.000Z","updated_at":"2025-10-22T08:31:37.000Z","dependencies_parsed_at":"2025-01-01T16:11:40.420Z","dependency_job_id":"f94c8f17-6a68-4eb1-a366-5652c0517cc0","html_url":"https://github.com/LetMeFly666/YuketangAutoPlayer","commit_stats":null,"previous_names":["letmefly666/yuketangautoplayer"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/LetMeFly666/YuketangAutoPlayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FYuketangAutoPlayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FYuketangAutoPlayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FYuketangAutoPlayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FYuketangAutoPlayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LetMeFly666","download_url":"https://codeload.github.com/LetMeFly666/YuketangAutoPlayer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LetMeFly666%2FYuketangAutoPlayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283652069,"owners_count":26871286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-10T02:00:06.292Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-12T09:48:55.708Z","updated_at":"2025-11-10T09:04:19.421Z","avatar_url":"https://github.com/LetMeFly666.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n * @Author: LetMeFly\n * @Date: 2023-09-22 18:26:15\n * @LastEditors: LetMeFly.xyz\n * @LastEditTime: 2025-10-22 16:26:35\n--\u003e\n# YuketangAutoPlayer\n\n雨课堂刷课脚本（雨课堂视频自动播放），基于浏览器模拟的方式运行，无需虚拟机，甚至可以以无窗口模式运行。（MOOC）\n\n视频演示地址：[Bilibili@BV15K4y1F7EN](https://www.bilibili.com/video/BV15K4y1F7EN/)\n\n\u003c!-- \u003ciframe src=\"//player.bilibili.com/player.html?aid=873783562\u0026bvid=BV15K4y1F7EN\u0026cid=1275745338\u0026p=1\" scrolling=\"no\" border=\"0\" frameborder=\"no\" framespacing=\"0\" allowfullscreen=\"true\"\u003e \u003c/iframe\u003e --\u003e\n\n[![](img/video-cover.jpg)](https://www.bilibili.com/video/BV15K4y1F7EN/)\n\n## 使用方法\n\n主要分为四步：\n\n1. 配置Python环境\n2. 配置浏览器驱动（推荐Chrome浏览器）\n3. 设置刷课信息\n4. 开始刷课\n\n### 一、配置Python环境\n\n记得安装好`selenium`\n\n```bash\npip install selenium\n```\n\n### 二、配置浏览器驱动\n\n本项目默认以Chrome为例，以Windows系统为例。其他浏览器原理类似、其他操作系统原理类似。\n\n首先电脑上要安装有[Chrome浏览器](https://www.google.cn/chrome/index.html)（别装到假的Chrome了，之前有同学装了个假Chrome后来问我为什么程序不能正常运行QAQ）\n\n其次需要下载**对应版本的**`ChromeDriver`：[下载地址1](https://chromedriver.chromium.org/downloads)、[下载地址2](https://googlechromelabs.github.io/chrome-for-testing/)、[下载地址3](https://github.com/LetMeFly666/YuketangAutoPlayer/releases/download/v0.0/chromedriver.exe)、[教程1](https://blog.csdn.net/fighting_jiang/article/details/116298853)、[教程2](https://blog.csdn.net/zhoukeguai/article/details/113247342)、[最后的尝试](https://cn.bing.com/search?q=chromedriver%E4%B8%8B%E8%BD%BD)。（版本相差不大的话也无所谓）\n\n将`ChromeDriver.exe`放到`环境变量`中 或 `脚本(执行)目录`下。\n\n### 三、设置刷课信息\n\n打开`main.py`，代码头部存在以下信息，需要你自己修改：\n\n```python\nIF_HEADLESS = False  # 是否以无窗口模式运行（首次运行建议使用有窗口模式以观察是否符合预期）\nCOURSE_URL = 'https://grsbupt.yuketang.cn/pro/lms/84eubUXLHEy/17556639/studycontent'  # 要刷的课的地址（获取方式见README）\nCOOKIE = 'sjfeij2983uyfh84y7498uf98ys8f8u9'  # 打死也不要告诉别人哦（获取方式见README）\n```\n\n#### ①IF_HEADLESS\n\n是否以无窗口模式运行。建议以有窗口模式运行（那就不用改这一行了）。\n\n若以无窗口模式运行，则不会弹出Chrome浏览器界面，但视频仍能正常刷取。\n\n#### ②COURSE_URL\n\n你要刷的课的URL。\n\n进入雨课堂，进入你想要刷的课程，点击“学习内容”，复制地址栏的url即可。\n\n![how-to-get-url](img/how-to-get-url.jpg)\n\n（注意是https格式的哦）\n\n#### ③COOKIE\n\n**若你觉得COOKIE的获取比较麻烦，你可以选择[跳过这一步](#四开始刷课)并每次重新扫码登录。**扫码登录不支持HEADLESS模式。\n\nCOOKIE用来告诉雨课堂你是你。获取方式如下：\n\n登录（你们学校的）雨课堂，`打开开发者工具`（下图的步骤1，也可百度），依次点击“应用→存储→Cookie→ https\u0026#58;\u0026#47;\u0026#47;xxx.yuketang... ”，复制**sessionid**对应的值\n\n![/how-to-get-cookie](img/how-to-get-cookie.jpg)\n\n### 四、开始刷课\n\n```python\npython main.py\n```\n\n## 使用提示\n\n注意，使用过程中可以缩浏览器小窗口去干其他事情，但尽量不要将鼠标移动到程序弹出的浏览器窗口上。因为本项目的运行原理就是模拟用户对浏览器的控制。\n\n**缓存**：若视频播放完毕程序正常结束，则缓存将被自动清理。若视频未播放完毕提前关掉了程序，则Windows系统下缓存位置在`%temp%/chrome_BITS_xxx`下。\n\n## 感谢列表\n\n+ 感谢[Github@SwordLikeRain](https://github.com/SwordLikeRain)的[Cookie错误时提示不准确的issue](https://github.com/LetMeFly666/YuketangAutoPlayer/issues/1)（good first issue），使得程序修改后支持了每次扫码登录。\n+ 感谢[BiliBili@Bacch](https://space.bilibili.com/21043185)的`AttributeError: 'WebDriver' object has no attribute 'find_elements_by_class_name'`的[报错提醒](https://www.bilibili.com/video/BV15K4y1F7EN/#reply187204230304)，使得程序修改后兼容了selenium≥4.0。\n+ 感谢[BiliBili@青鹧不懂蓝桉情](https://space.bilibili.com/1208020409)提供的账号，使得程序修改后支持了`www.yuketang.cn`这种域名下的雨课堂界面。\n+ 感谢[Github@420xincheng](https://github.com/420xincheng)的[没刷完视频，就自动退出的解决方法(#8)](https://github.com/LetMeFly666/YuketangAutoPlayer/issues/8)，播放完毕一个视频刷新后等待5秒防止页面暂未加载完成。\n+ 感谢[Github@Guo-Chenxu](https://github.com/Guo-Chenxu)的[`ifVideo`函数修改(#13)](https://github.com/LetMeFly666/YuketangAutoPlayer/issues/13)，更新COMMONUI下未播放视频的判断逻辑。\n+ 感谢[Github@泠辰](https://github.com/Crsuh2er0)的[已过期视频循环播放bugfix (#17)](https://github.com/LetMeFly666/YuketangAutoPlayer/pull/17)，修复了存在已过期视频时会重复播放已过期视频的问题。\n\n## TODO\n\n- [ ] 抽象一个获取待播放视频的函数([Suggest](https://github.com/LetMeFly666/YuketangAutoPlayer/pull/17#discussion_r2450825512)ed by Copilot)。\n\n## 免责声明\n\n本项目的唯一目的是：selenium技术的学习与实践。\n\n禁止用于其他用途，下载后请于24h内删除【Doge】。\n\n\u003csmall\u003e若导致账号封禁（目前来看完全不会）或其他因BUG造成的损失，与本项目无关。\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fyuketangautoplayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletmefly666%2Fyuketangautoplayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletmefly666%2Fyuketangautoplayer/lists"}