Skip to content

网课平台自动登录, 自动获取课程, 自动进入课程, auto-script-projects for OnlineCourceScript

License

Notifications You must be signed in to change notification settings

enncy/auto-script-ocs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-script-ocs

auto-script-projects for OnlineCourseScript

ocs 的自动化测试脚本

功能:

  • 超星自动登录
  • 超星自动获取课程
  • 超星自动进入课程,作业,考试

使用

// install this project 安装此项目
npm i auto-script-ocs

新建index.js文件复制以下内容然后 node index.js
或者在你的 node 程序中调用

const ASOcs = require('auto-script-ocs')

let options = {
    //启动类型,目前有 : cx
    type:'cx', 
    //开启验证码破解,如果你不想用验证码破解功能,想手动输入验证码,使用 use_breakCode: false
    use_breakCode: false,
    //破解验证码的配置,请到 http://www.ttshitu.com/ 打码平台配置你的 account账号和 password密码
    breakCode: {
        username: '...',
        password: '...',
    },
    //学校名称
    school: "北京大学",
    //账号名称
    account: '123456789',
    //密码
    password: '123456789'
}
/**
 * 使用默认方式打开本机上存在的chrome浏览器,此时打开的浏览器是纯净的浏览器什么都没有
 */
const ocs = new ASOcs(options) //传入options配置

ocs.launch().then(async browser=>{
    //启动浏览器并登录
    await ocs.login.start()
    //获取课程信息
    const course_info =await ocs.course.getCourseInfo()
    console.log(course_info);
    //进入学习界面
    await ocs.course.gotoStudy( course_info[0].url)
    //进入考试界面
    await ocs.course.gotoExam(course_info[0].url)
    //进入作业界面
    await ocs.course.gotoWork( course_info[0].url)
    //关闭浏览器
    browser.close()
}).catch(e=>{
    console.error(e);
})
 
 

Api

AutoScriptOcs

class:AutoScriptOcs(options)

options

  • type <string> cx | ... 超星 ,目前只支持 cx

  • use_breakCode <boolean> 是否开启验证码破解 ,

  • breakCode <Object> 此属性必须先开启 use_breakCode : true ,请到 http://www.ttshitu.com/docs/ 打码平台配置你的 account账号和 password密码

  • school <string> 网课平台学校名

  • account <string> 网课平台账号

  • password <string> 网课平台密码

Property

Methods

ASOcsLogin

登录类,start() 作为主函数使用,其他方法不建议调用

Methods

start() return <Promise> 开始登录函数

具体实现类 : CXLogin

ASOcsCourse

Methods

About

网课平台自动登录, 自动获取课程, 自动进入课程, auto-script-projects for OnlineCourceScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published