Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
the composition of cheerio and hyperquestionable
JavaScript
Tag: v2.2.1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.jshintrc
README.md README style nitpickery
cheerful.js
cli.js
package.json

README.md

cheerful

the composition of Cheerio and hyperquestionable

Installation

$ npm install cheerful

API

var request$ = require('cheerful')

request$(url, function cb(err, $))

request url using hyperquestionable, run it through cheerio and hand it back to you. The HTTP status code is added to the Cheerio object and to Cheerio errors as statusCode.

Example:

var request$ = require('cheerful')
request$('http://google.com', findDoodle)
function findDoodle(err, $) {
  var headers = (err || $).headers
  if (headers && headers.location)
    return request$(headers.location, findDoodle)
  if (err) return console.error('error', err)

  var div = $('center div[title="Google"]')
  var img = 'http://google.com'+ div.attr('style').match(/url\((\S+)\)/)[1]
  console.log('today\'s Google Doodle:', img)
}

License

MIT

Something went wrong with that request. Please try again.