MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / _parse_entries

Method _parse_entries

scripts/fetch_updates.py:1317–1356  ·  view source on GitHub ↗

Parse article blocks from EC Latest Updates page.

(self, html: str)

Source from the content-addressed store, hash-verified

1315 return None
1316
1317 def _parse_entries(self, html: str) -> list[dict]:
1318 """Parse article blocks from EC Latest Updates page."""
1319 results = []
1320 article_re = re.compile(r"<article[^>]*>(.*?)</article>", re.DOTALL)
1321
1322 for art_match in article_re.finditer(html):
1323 art = art_match.group(1)
1324
1325 date_m = re.search(r'<time[^>]*datetime="([^"]+)"', art)
1326 date_str = date_m.group(1)[:10] if date_m else ""
1327
1328 title = ""
1329 link = ""
1330 title_block = re.search(
1331 r'class="ecl-content-block__title"[^>]*>(.*?)</(?:h\d|div|span)',
1332 art, re.DOTALL,
1333 )
1334 if title_block:
1335 link_m = re.search(r'<a[^>]*href="([^"]+)"[^>]*>([^<]+)</a>',
1336 title_block.group(1))
1337 if link_m:
1338 link = link_m.group(1)
1339 title = link_m.group(2).strip()
1340 else:
1341 title = re.sub(r"<[^>]+>", "", title_block.group(1)).strip()
1342
1343 if link and link.startswith("/"):
1344 link = "https://health.ec.europa.eu" + link
1345
1346 if not title:
1347 continue
1348
1349 results.append({
1350 "title": title,
1351 "date": date_str,
1352 "link": link,
1353 "type": "EC News",
1354 })
1355
1356 return results
1357
1358
1359# ---------------------------------------------------------------------------

Callers 1

checkMethod · 0.95

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected