Skip to content

Instantly share code, notes, and snippets.

Last active July 16, 2019 17:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Scraping the web with Nodejs. Code for the blog post ->
const axios = require("axios");
const cheerio = require("cheerio");
const scrape = async url => {
const { data } = await axios.get(url).catch(err => console.log(err));
const $ = cheerio.load(data);
const result = $(".skill-col").text();
return result;
(async ()=> {
console.log(await scrape(""))
} )()
const Nightmare = require("nightmare");
const nightmare = Nightmare({ show: true });
.type("#search_form_input_homepage", "how to scrape using nightmarejs")
.wait("#r1-0 a.result__a")
.evaluate(() => document.querySelector("#r1-0 a.result__a").href)
.catch(error => {
console.error("Search failed:", error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment