(html: string)
| 45 | } |
| 46 | } |
| 47 | function extractMainContent(html: string): string { |
| 48 | try { |
| 49 | const $ = cheerio.load(html); |
| 50 | $("script, style, head, nav, footer, iframe, img").remove(); |
| 51 | return $("body").text().replace(/\s+/g, " ").trim(); |
| 52 | } catch (error) { |
| 53 | console.error('Error extracting main content:', error); |
| 54 | throw error; |
| 55 | } |
| 56 | } |
| 57 | const promises = sources.map(async (source): Promise<ContentResult | null> => { |
| 58 | try { |
| 59 | const response = await fetchWithTimeout(source.link, {}, 800); |
no outgoing calls
no test coverage detected