Recursively check a website for broken links.
npx links-awakening 'https://styfle.dev'
Output
โ
https://styfle.dev/
โ
https://styfle.dev/projects
โ
https://styfle.dev/blog
โ
https://styfle.dev/contact
โ
https://twitter.com/styfle
โ
https://keybase.io/styfle
โ
https://github.com/styfle
โ
https://www.npmjs.com/~styfle
โ
https://styfle.dev/blog/copee-released
โ
http://googlechromereleases.blogspot.com/
โ
https://developers.google.com/web/updates/
โ
https://developers.google.com/web/updates/2015/04/cut-and-copy-commands
โ http://zeroclipboard.org/ (status: 500, referer: https://styfle.dev/blog/copee-released)
โ
http://styfle.github.io/copee/
โ
https://styfle.dev/blog/d3js-graph-prod
โ https://styfle.dev/slides/d3js.html (status: 404, referer: https://styfle.dev/blog/d3js-graph-prod)
import { awaken, type AwakenResult } from 'links-awakening';
const onAwaken = ({ url, status }: AwakenResult) => {
const icon = status >= 200 && status <= 299 ? 'โ
' : 'โ';
console.log(`${icon} ${url}`);
};
const url = new URL('https://example.com/blog');
const results = new Map<string, AwakenResult>();
await awaken({ url, onAwaken, results });
console.log(`Done! Crawled ${results.size} links.`);