Skip to main content
Deno 2 is finally here 🎉️
Learn more

Deno Cheerio

Test Scrape Deno

Cheerio - Porting Cheerio Node Module To Deno using esm.sh

Prerequisites

Usage

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);
  });

Testing

deno run --allow-net --allow-read test.ts

or

deno task test

Credits

LICENSE

MIT