MCPcopy Create free account
hub / github.com/developersdigest/llm-answer-engine / extractMainContent

Function extractMainContent

app/tools/contentProcessing.tsx:47–56  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

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);

Callers 1

get10BlueLinksContentsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected