MCPcopy
hub / github.com/Snailclimb/JavaGuide / readPageHtml

Function readPageHtml

scripts/docsearch-index.mjs:75–89  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

73}
74
75async function readPageHtml(url) {
76 if (!sourceDir) {
77 return fetchText(url);
78 }
79
80 const { pathname } = new URL(url);
81 const relativePath =
82 pathname === "/"
83 ? "index.html"
84 : pathname.endsWith("/")
85 ? path.join(decodeURIComponent(pathname.slice(1)), "index.html")
86 : decodeURIComponent(pathname.slice(1));
87
88 return readFile(path.join(sourceDir, relativePath), "utf8");
89}
90
91function extractUrlsFromSitemap(xml) {
92 const urls = [...xml.matchAll(/<loc>(.*?)<\/loc>/g)]

Callers 1

mainFunction · 0.85

Calls 1

fetchTextFunction · 0.85

Tested by

no test coverage detected