Skip to content

A simple but powerful and programable http agent to imitate requests from browsers.

License

Notifications You must be signed in to change notification settings

kaelzhang/node-talking-bird

Repository files navigation

Build Status

talking-bird

A simple but powerful and programable http agent to imitate requests from browsers.

Install

$ npm install talking-bird --save

Usage

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!

browser.session(options)

Create a brand-new session with everything initialized.

Returns Session

options

  • userAgent String

session.visit(url)

Imitate a browser to visit a url, handles header

Returns Promise.<Document>

  • Promise.resolve if the http status indicates successful
  • otherwise Promise.reject

Struct: Document

  • response Object
  • ajax Request
  • cookies Cookie

Class: Request

Class: Cookie

License

MIT

About

A simple but powerful and programable http agent to imitate requests from browsers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published