npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auto-script-ocs

v1.1.23

Published

auto-script-projects for OnlineCourceScript

Downloads

5

Readme

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

  • launch() return <Browser> 默认启动方式,初始化

  • launchByDebug(options) return <Browser> 调试模式启动,具体见 see https://chromedevtools.github.io/devtools-protocol/

    • options <Object>

      • binary_path <string> 被调试的浏览器可执行文件路径 ,例如 ..../chrome.exe

      • port <number> 调试模式指定端口

ASOcsLogin

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

Methods

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

具体实现类 : CXLogin

ASOcsCourse

Methods

  • getCourseInfo() return <Promise<Array>> 获取课程信息,返回一个课程数组

  • 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