Created
August 23, 2022 03:52
-
-
Save jasonraimondi/5192b744a1bd4eb72fcfea3da4719630 to your computer and use it in GitHub Desktop.
cheerio
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
import axios from "axios"; | |
import * as cheerio from "cheerio"; | |
import fs from "fs/promises"; | |
// import prettier from "prettier"; | |
void (async function () { | |
const res = await axios.get( | |
"https://google.com" | |
); | |
// const formatted = prettier.format(res.data); | |
fs.writeFile("./tmp/foo.html", res.data); | |
const $ = cheerio.load(res.data); | |
const sales = $(".u__text--success"); | |
const foo = sales.text(); | |
console.log(foo); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment