Cheerio - Porting Cheerio Node Module To Deno using esm.sh
- Deno on your System https://deno.land/#installation
- Cheerio Full Docs and usage - https://cheerio.js.org/
import { cheerio } from "https://deno.land/x/denocheerio/mod.ts";
fetch(
"https://notes.santhoshveer.com/",
)
.then((result) => result.text())
.then((html) => {
const $ = cheerio.load(html);
const title = $('meta[property="og:title"]').attr("content") ||
$("title").text() || $('meta[name="title"]').attr("content");
const description = $('meta[property="og:description"]').attr("content") ||
$('meta[name="description"]').attr("content");
console.log(title);
console.log(description);
}).catch((error) => {
console.log(error);
});
deno run --allow-net --allow-read test.ts
or
deno task test
- cheerio Npm Module - https://github.com/cheeriojs/cheerio
MIT