🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

cheerful

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheerful

the composition of cheerio and hyperquestionable

2.2.1
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

cheerio

FAQs

Package last updated on 25 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts