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

dama2

v0.0.2

Published

打码兔,验证码自动输入,打码

Downloads

3

Readme

打码兔 Node.js SDK

NPM


Install

not post to npm, pelease wait some days

$ npm install dama2 --save

Test

modify the appID, appKey, username, password at first

$ mocha test

Usage

Dama2 = require('dama2')
 
appID = 'your appID';
appKey = 'your appKey';
user = 'username';
pwd = 'password';
dama2 = new Dama2(appID, appKey, user, pwd);

// login
dama2.login(function(error, auth) {

  // read user info
  dama2.readUserInfo(function(error, userInfo) {
    ...
  })

  // get verify code by file
  dama2.decodeFile(44, 'test.jpg', null, 30, function (error, result) {
    ...
  })

  // get verify code by url
  dama2.decode(44, 'http://www.dama2.com/Index/imgVerify',
    null, null, null, null, function (error, result){
    ...
  })

})
      

API

All of dama2's api follow the rule the first param alway is Error object, the other is the real data.

constructor(appId, appKey, username, password, apiBaseUrl)

// apiBaseUrl, default is http://api.dama2.com:7788, not require
var dama2 = new Dama2(appId, appKey, username, password)

login(callback)

// auth is dama2 authed string, for other api
dama2.login(function(error, auth) {
  ...
})

register(userInfoObj, appID, appKey, callback)

// userInfoObj = {
    user: 'username',
    pwd: 'password',
    qq: 'qq number',
    email: 'email',
    tel: 'tel number'
}
dama2.register(userInfoObj, appID, appKey, function(error, result) {
  ..
})

readUserInfo(callback)

// must logined, otherwise throw error
dama2.readUserInfo(function(error, userInfo){
  ...
})

getBalance(callback)

// must logined
dama2.getBalance(function(error, balanceInfo){
  ...
})

decode(type, url, len=0, timeout=60, cookie='', referer='', callback)

// type is your verify code type, http://wiki.dama2.com/index.php?n=ApiDoc.Pricedesc
// url is verify code image's url
dama2.decode(44, 'http://www.google.com/img1.jpg', 0, 0, 0, 0, function(error, result){
  ...
})

decodeFile(type, filePath, len=0, timeout=60, callback)

type is your verify code type
dama2.decodeFile(44, '/home/gj/img.jpg', 0, 60, function(error, result) {
  ....
})

getResult(id, callback)

// id is in result of decode or decodeFile function
// after decode, you need call getResult to get the result of the verify code image
dama2.getResult(id, function(error, result) {
  ...
})

reportError(id, callback)

// when the verify code is wrong, you can report it to service
dama2.reportError(id, function(error, result) {
  ...
})

simpleDecode(type, url, referer, callback)

// auto call getResult after decode
dama2.simpleDecode(44, 'http://baidu.com/img1.jpg', '', function(error, id, ret){
  ...
})

simpleDecodeFile(type, filePath, callback)

// auto call getResult after decodeFile
dama2.simpleDecodeFile(44, 'http://baidu.com/img1.jpg', function(error, id, ret){
  ...
})

TODO

1.batch decode

2.wait decode finish then callback

3.emit event when decode finish