Created
December 22, 2020 01:58
-
-
Save iamnotstatic/0a9920198c9106ec71f98ecf7e95ea4d to your computer and use it in GitHub Desktop.
Web scrapping
This file contains 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 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