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

Function fetchPageContent

express-api/index.js:67–80  ·  view source on GitHub ↗
(link)

Source from the content-addressed store, hash-verified

65 }
66 // 17. Fetch page content
67 const fetchPageContent = async (link) => {
68 console.log(`7. Fetching page content for ${link}`);
69 try {
70 const response = await fetch(link);
71 if (!response.ok) {
72 return ""; // skip if fetch fails
73 }
74 const text = await response.text();
75 return extractMainContent(text, link);
76 } catch (error) {
77 console.error(`Error fetching page content for ${link}:`, error);
78 return '';
79 }
80 };
81 // 18. Extract main content from the HTML page
82 function extractMainContent(html, link) {
83 console.log(`8. Extracting main content from HTML for ${link}`);

Callers 1

fetchAndProcessFunction · 0.85

Calls 1

extractMainContentFunction · 0.70

Tested by

no test coverage detected