MCPcopy
hub / github.com/simstudioai/sim / extractLinks

Method extractLinks

apps/sim/lib/file-parsers/html-parser.ts:268–282  ·  view source on GitHub ↗

* Extract links from the document

($: cheerio.CheerioAPI)

Source from the content-addressed store, hash-verified

266 * Extract links from the document
267 */
268 private extractLinks($: cheerio.CheerioAPI): Array<{ text: string; href: string }> {
269 const links: Array<{ text: string; href: string }> = []
270
271 $('a[href]').each((_, element) => {
272 const $element = $(element)
273 const href = $element.attr('href')
274 const text = $element.text().trim()
275
276 if (href && text && href.startsWith('http')) {
277 links.push({ text, href })
278 }
279 })
280
281 return links
282 }
283}

Callers 1

parseBufferMethod · 0.95

Calls 4

attrMethod · 0.80
textMethod · 0.80
$Function · 0.50
pushMethod · 0.45

Tested by

no test coverage detected