Skip to content

Instantly share code, notes, and snippets.

View marcomontalbano's full-sized avatar

Marco Montalbano marcomontalbano

View GitHub Profile
// npm install turndown cheerio
import TurndownService from "turndown"
import { load } from "cheerio"
async function downloadUrlAsMarkdown(url: string, selector?: string) {
try {
const res = await fetch(url)
if (!res.ok) {
throw new Error(`${url} ${res.status} ${res.statusText}`)