yscode

1.3.1 • Public • Published

YSCode

一个简单的云速打码模块.

安装

node:

$ npm install yscode

##示例

const Yscode = require('yscode');
const options = {
    "username": "username",
    "password": "password",
    "softid"  : "softid",
    "softkey" : "softkey"
}
const ys = new Yscode(options);
let header = {
    'Cookie': 'some cookie'
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'
}

let imgUrl = `http://www.baidu.com`;
let type = 1040;

ys
    .header(header)
    .getImg(imgUrl)
    .imgToCode(type, function (result) {
       console.log(result);
})

详细说明

调用云速打码接口:

说明 方法名 参数名 类型 必要性
设置请求头 .header header Object 选填
设置图片地址 .getImg img String 必填
设置类型 .type type String 选填 [url, base64] 默认为'url', 如果为base64则会将img作为base64解析
图片转CODE .imgToCode type String 选填 默认3000
  • 使用Promise:
ys
    .header(header)
    .getImg(imgUrl)
    .imgToCode(type)
    .then(function (result) {
        console.log(result);
    })

or

async function () {
    let result = await ys.header(header).getImg(imgUrl).imgToCode(type);
    console.log(result);
}

License

ISC

Readme

Keywords

Package Sidebar

Install

npm i yscode

Weekly Downloads

0

Version

1.3.1

License

ISC

Last publish

Collaborators

  • merry