Skip to content

Instantly share code, notes, and snippets.

@iamnotstatic
Created December 22, 2020 01:58
Show Gist options
  • Save iamnotstatic/0a9920198c9106ec71f98ecf7e95ea4d to your computer and use it in GitHub Desktop.
Save iamnotstatic/0a9920198c9106ec71f98ecf7e95ea4d to your computer and use it in GitHub Desktop.
Web scrapping
const axios = require("axios");
const cheerio = require("cheerio");
const url = "https://stackoverflow.com/jobs";
(async () => {
try {
const res = await axios.get(url);
const html = res.data;
//loading response data into a Cheerio instance
const $ = cheerio.load(html);
const siteName = $(".-logo").text();
// This would return the site Name
console.log(siteName);
} catch (error) {
console.log(error);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment