This file contains hidden or 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
| // 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}`) |
OlderNewer