1.1.23 • Published 3 years ago

auto-script-ocs v1.1.23

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

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

  • gotoStudy(course_url) return < Promise< boolean>> 进入学习界面

  • gotoWork(course_url) return <Promise< boolean>> 进入作业界面

  • gotoExam(course_url) return <Promise< boolean>> 进入考试界面

    • course_url <string> 课程链接 , 例如 getCourseInfo()[0].url

具体实现类:CXCourse

CXLogin

@see src\cx\course.ts

CXCourse

@see src\cx\login.ts

BrowserUtils

@see src\utils\browser.ts

Browser

@see https://zhaoqize.github.io/puppeteer-api-zh_CN/#?product=Puppeteer&version=v5.5.0&show=api-class-browser

1.1.23

3 years ago

1.1.21

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago