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

Function parseIndex

web/scripts/import-97-things.mjs:62–72  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

60};
61
62const parseIndex = (html) => {
63 const itemPattern = /<li><a href="([^"]+)">([\s\S]*?)<\/a>, por ([\s\S]*?)<\/li>/g;
64
65 return [...html.matchAll(itemPattern)].map((match, index) => ({
66 number: index + 1,
67 slug: match[1].replace(/\.html$/, ''),
68 sourcePath: match[1],
69 title: stripTags(match[2]),
70 author: stripTags(match[3]),
71 }));
72};
73
74const parseAdvicePage = (html, pageUrl, localAdvicePaths) => {
75 const headingPattern = /<h2>([\s\S]*?)<br>\s*<small>Autor:\s*([\s\S]*?)<\/small><\/h2>/;

Callers 1

Calls 1

stripTagsFunction · 0.85

Tested by

no test coverage detected