A simple but powerful and programable http agent to imitate requests from browsers.
$ npm install talking-bird --save
const browser = require('talking-bird')
// Start a new session
const session = browser.session({
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
})
const {
cookies,
ajax
} = await session.visit('http://dangerous.com')
const url = 'http://dangerous.com/403-if-direct-access-without-sessionid-cookie'
const {
status
} = await ajax.request({url})
console.log(status) // 200
// Oh Yeah!
Create a brand-new session with everything initialized.
Returns Session
options
- userAgent
String
Imitate a browser to visit a url, handles header
Returns Promise.<Document>
Promise.resolve
if the http status indicates successful- otherwise
Promise.reject
- response
Object
- ajax
Request
- cookies
Cookie
MIT