Created
October 23, 2016 07:41
-
-
Save josephok/f41426a03c57d0f2f96f3ca0dedbf9d7 to your computer and use it in GitHub Desktop.
request use nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'), | |
cheerio = require('cheerio'), | |
colors = require('colors') | |
const log = console.log | |
const URL = 'https://nqdeng.github.io/7-days-nodejs/' | |
request(URL, (error, response, body) => { | |
if (!error && response.statusCode == 200) { | |
let $ = cheerio.load(body) | |
log($("header > h1").text().green) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment