2.5.1 • Published 2 years ago

bird-auth v2.5.1

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

bird-auth

NPM Version NODE Version OSX Build LINUX Build

解决 birdv1 版本手动取cookie问题, 支持网易云音乐、百度认证。

Install

npm install --save-dev bird-auth

API

birdAuth

nameapiinstance function
clientclient[fn]not support
baidu.uuapbirdAuth.baidu.uuap(options[, callback])retry, getCookie
baidu.passportbirdAuth.baidu.passport(options[, callback])getCookie
netease.musicbirdAuth.netease.music(options[, callback])retry, getCookie, aesEncrypt

client

methoddemodetail
url_getclient.url_get(url, callback)get method(no cookie)
getclient.get(url, callback)get method(with cookie)
postclient.post(options, callback)post method(with cookie)
get_cookies_stringclient.get_cookies_string()get all cookies
update_cookiesclient.update_cookies(cookies, true)update new cookies
set_cookiesclient.set_cookies(cookies, true)set new cookies
clear_cookiesclient.clear_cookies()remove all cookies

Command Line

usage: bird -u xxx -p xxx -t netseae_music

Options:
  -h, --help      Show help                                           [boolean]
  -t, --type      baidu_uuap, baidu_passport, netease_music           [default: "baidu_uuap"]
  -u, --username  username                                            [required]
  -p, --password  password                                            [required]
  -s, --server    server(baidu_uuap need it), if you don't know this, you can logout you system and get url.

Examples

baidu uuap auth

const birdAuth = require('bird-auth')
const uuap = new birdAuth.baidu.uuap({
    username: 'xxx',
    password: 'xxx',
    type: 3, // default 1 is username and password; 3 is username and verification code.
    uuapServer: 'http://xxx.baidu.com/login', // CAS auth url 
    service: 'http://xxx.baidu.com/' // service address, if you don't know this url, you can logout you system, and get `service` parameters
}, function(cookie) {
    console.log(cookie)
});

uuap.retry({
    username: 'xxx',
    password: 'xxx',
    uuapServer: 'http://xxx.baidu.com/login',
    service: 'http://xxx.baidu.com/'
});

baidu passport auth

const birdAuth = require('bird-auth')
const passport = new birdAuth.baidu.passport({
    username: 'xxx',
    password: 'xxx',
    service: 'https://passport.baidu.com/v2/?login' //default passport.baidu.com
}, function(cookie) {
    console.log(cookie)
});

netease music auth

const birdAuth = require('bird-auth')
const music = new birdAuth.netease.music({
    username: 'xxx', // phone number or mail
    password: 'xxx'
}, function(cookie) {
    console.log(cookie)
});

History

  • 2.5.0 remove querystring package.
  • 2.4.1 fix url check method.
  • 2.4.0 switch login to authorize.
  • 2.3.1 add type option to auth parameter.
  • 2.3.0 fix token verification mechanism.
  • 2.2.1 modify parameter naming.
  • 2.2.0 change login to authorize.
  • 2.1.0 remove service params.
  • 2.0.0 refactor & update auth.
  • 1.2.8 add auth rsa check.
  • 1.2.7 add client.set_cookies & client.clear_cookies method.
  • 1.2.5 add client.update_cookies method.
  • 1.2.4 fix passport test(qatest/rdtest) auth bug.
  • 1.2.0 group auth and add netease music auth.
  • 1.1.10 add httpClient Content-Type adjust.
  • 1.1.9 fix passport agent.
  • 1.1.6 Fixup 302 response location is not a normal url 😂
  • 1.1.3 Custom agent to fix https authorized bug. :(
  • 1.1.0 Add bird-auth command, you can use bird-auth -h to see more :)
  • 1.0.6 Fixed get_cookies_string bug
  • 1.0.5 Fixed Syntax Error
  • 1.0.4 Fixed passport auth bugfix
  • 1.0.3 Project init

Future

  • refactor with typescript.
  • optimize function, remove useless code.
  • Change account and get cookie afresh
  • Support Https
  • Support online Passport auth
  • Set rejectUnauthorized false and fix uuap auth bug. detail
  • Add bprouting support
  • statusCode === 302 judgment
2.5.0

2 years ago

2.5.1

2 years ago

2.4.1

2 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.3.1

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.8

6 years ago

1.2.7

9 years ago

1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.1.10

9 years ago

1.1.9

9 years ago

1.1.8

9 years ago

1.1.7

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

1.2.0

10 years ago