学习通自动刷网课脚本实现

哥们,小心账号封禁、学术诚信问题甚至法律风险。出现任何问题别找我哈。

一、浏览器脚本方案(无需编程基础)

1. Tampermonkey油猴脚本实现

这是最简单易用的方案,适合大多数用户:

  1. 安装 Tampermonkey 插件

    • Chrome 用户访问 Chrome 应用商店安装

    • Firefox 用户访问 Firefox 扩展商店安装

  2. 添加学习通自动刷课脚本

    // ==UserScript==
    // @name         学习通自动刷课助手
    // @namespace    http://tampermonkey.net/
    // @version      1.0
    // @description  自动播放学习通视频、处理防挂机检测、自动切换章节
    // @author       YourName
    // @match        *://mooc1-*.chaoxing.com/*
    // @grant        none
    // ==/UserScript==
    
    (function() {
        'use strict';
        
        // 设置播放速度为1.5倍(安全范围)
        document.querySelector('video').playbackRate = 1.5;
        
        // 自动点击"继续学习"按钮
        setInterval(function() {
            const continueBtn = document.querySelector('.continue_btn, .vjs-big-play-button');
            if (continueBtn) {
                continueBtn.click();
            }
        }, 30000); // 每30秒检查一次
        
        // 自动切换到下一章节
        setInterval(function() {
            if (document.querySelector('.vjs-ended')) {
                const nextBtn = document.querySelector('.next_btn, .next');
                if (nextBtn) {
                    nextBtn.click();
                }
            }
        }, 60000); // 每60秒检查一次
        
        // 随机鼠标移动模拟活动
        setInterval(function() {
            const x = Math.random() * window.innerWidth;
            const y = Math.random() * window.innerHeight;
            window.dispatchEvent(new MouseEvent('mousemove', {
                clientX: x,
                clientY: y
            }));
        }, 180000); // 每3分钟移动一次鼠标
    })();
  3. 使用说明

    • 安装脚本后刷新学习通页面即可自动运行

    • 建议播放速度设置为 1.5-2 倍速,过高可能被检测

    • 脚本会自动处理防挂机检测和章节切换

二、Auto.js移动端自动化方案(安卓)

对于希望在手机上自动刷课的用户,可以使用 Auto.js 实现:

// Auto.js学习通自动刷课脚本
auto.waitFor();
console.show();

// 启动学习通APP
launchApp("学习通");
sleep(5000);

// 登录流程(需根据实际界面调整)
if (text("登录").exists()) {
    text("登录").findOne().click();
    sleep(3000);
    
    // 输入账号密码(需替换为您的信息)
    id("username").findOne().setText("您的学号");
    id("password").findOne().setText("您的密码");
    text("登录").findOne().click();
    sleep(5000);
}

// 进入课程列表
if (text("课程").exists()) {
    text("课程").findOne().click();
    sleep(3000);
}

// 选择第一个课程
className("android.widget.TextView").text("我的课程").findOne().parent().child(1).click();
sleep(5000);

// 自动刷课主循环
while (true) {
    // 查找并点击开始学习按钮
    if (text("开始学习").exists()) {
        text("开始学习").findOne().click();
        sleep(3000);
    }
    
    // 检测视频是否播放完毕
    if (text("重新播放").exists()) {
        back(); // 返回课程列表
        sleep(2000);
        // 点击下一个课程(需根据实际情况调整选择逻辑)
        className("android.widget.TextView").text("我的课程").findOne().parent().child(2).click();
        sleep(3000);
    }
    
    // 防挂机检测:随机点击屏幕
    if (random(0, 100) > 95) {
        click(random(100, 800), random(500, 1200));
    }
    
    sleep(5000); // 每5秒检查一次
}

使用说明

  1. 安装 Auto.js 应用并开启无障碍服务

  2. 将脚本导入 Auto.js 并运行

  3. 首次运行需要授予学习通相关权限

  4. 建议连接充电器使用,避免手机电量耗尽

三、Python自动化方案(高级)

对于有编程基础的用户,可以使用 Python+Selenium 实现更强大的自动化:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import random

# 初始化浏览器驱动
driver = webdriver.Chrome()
driver.get(" https://passport2.chaoxing.com/login ")

# 登录学习通
def login():
    try:
        # 输入账号密码(需替换为您的信息)
        username = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, "username"))
        )
        username.send_keys("您的学号")
        
        password = driver.find_element(By.ID, "password")
        password.send_keys("您的密码")
        
        # 点击登录按钮
        login_btn = driver.find_element(By.CLASS_NAME, "loginbtn")
        login_btn.click()
        time.sleep(5)
    except Exception as e:
        print("登录失败:", str(e))

# 自动刷课函数
def auto_study():
    try:
        # 进入课程页面
        course_link = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.XPATH, "//a[contains(text(),'课程')]"))
        )
        course_link.click()
        time.sleep(3)
        
        # 选择第一个课程
        first_course = driver.find_element(By.XPATH, "//div[@class='course-name']/a")
        first_course.click()
        time.sleep(3)
        
        # 处理iframe切换
        driver.switch_to.frame("frame_content")
        
        while True:
            # 查找并点击播放按钮
            play_btn = WebDriverWait(driver, 10).until(
                EC.presence_of_element_located((By.XPATH, "//div[contains(@class,'vjs-big-play-button')]"))
            )
            play_btn.click()
            
            # 设置播放速度(1.5倍)
            driver.execute_script("document.querySelector('video').playbackRate = 1.5;")
            
            # 随机活动防止检测
            for _ in range(6):  # 每10分钟执行一次
                # 随机滚动页面
                scroll_pos = random.randint(100, 500)
                driver.execute_script(f"window.scrollBy(0, {scroll_pos});")
                
                # 随机鼠标移动
                x = random.randint(0, 1000)
                y = random.randint(0, 800)
                driver.execute_script(f"window.dispatchEvent(new MouseEvent('mousemove', {{clientX: {x}, clientY: {y}}}));")
                
                time.sleep(100)  # 等待100秒
                
                # 检查是否播放完毕
                if driver.find_elements(By.XPATH, "//div[contains(@class,'vjs-ended')]"):
                    break
            
            # 切换到下一章节
            next_btn = driver.find_element(By.XPATH, "//button[contains(@class,'next_btn')]")
            next_btn.click()
            time.sleep(3)
            
    except Exception as e:
        print("刷课过程中出错:", str(e))
    finally:
        driver.quit()

if __name__ == "__main__":
    login()
    auto_study()

使用说明

  1. 需要安装 Python 和 Selenium 库:pip install selenium

  2. 下载对应浏览器版本的 WebDriver

  3. 修改代码中的账号信息和课程选择逻辑

  4. 建议使用虚拟环境运行

四、风险控制与优化建议

  1. 降低检测风险

    • 播放速度控制在 1.5-2 倍速以内

    • 添加随机延迟和随机操作模拟人工行为

    • 分时段刷课,避免长时间连续操作

  2. 账号安全

    • 优先使用小号测试脚本

    • 重要课程建议手动学习

    • 定期截图保存学习进度作为证据

  3. 脚本维护

    • 学习通更新后可能需要调整脚本

    • 关注相关论坛获取最新解决方案

    • 添加更多异常处理提高稳定性

五、法律与学术诚信提醒

  1. 法律风险

    • 大规模自动化刷课可能违反《计算机信息系统安全保护条例》

    • 篡改学习记录可能构成诈骗罪

    • 侵犯课程版权可能面临法律责任

  2. 学术诚信

    • 刷课行为破坏教育公平原则

    • 可能导致成绩无效或学术不端记录

    • 建议将自动化工具仅作为辅助手段


学习通自动刷网课脚本实现
https://uniomo.com/archives/xue-xi-tong-zi-dong-shua-wang-ke-jiao-ben-shi-xian
作者
雨落秋垣
发布于
2024年06月10日
许可协议