ba

bird-auth

get cookie and then you can use it with birdv1

Showing:

Popularity

Downloads/wk

38

Maintenance

No Maintenance Data Available

Package

Dependencies

6

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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',
    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.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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100