| 1 | import { extractFromHtml } from '@extractus/article-extractor' |
| 2 | import convertBody from 'fetch-charset-detection'; |
| 3 | |
| 4 | const input = process.argv[2]; |
| 5 | |
| 6 | try { |
| 7 | const res = await fetch(input); |
| 8 | const body = await res.arrayBuffer(); |
| 9 | const html = convertBody(body, res.headers); |
| 10 | const article = await extractFromHtml(html, input); |
| 11 | |
| 12 | console.log(JSON.stringify(article)); |
| 13 | } |
| 14 | catch (err) { |
| 15 | console.error(err); |
| 16 | } |