MCPcopy
hub / github.com/midudev/libros-programacion-gratis / fetchText

Function fetchText

web/scripts/import-97-things.mjs:52–60  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

50 .trim();
51
52const fetchText = async (url) => {
53 const response = await fetch(url);
54
55 if (!response.ok) {
56 throw new Error(`Could not fetch ${url}: ${response.status} ${response.statusText}`);
57 }
58
59 return response.text();
60};
61
62const parseIndex = (html) => {
63 const itemPattern = /<li><a href="([^"]+)">([\s\S]*?)<\/a>, por ([\s\S]*?)<\/li>/g;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected