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

Method _parse_entries

scripts/fetch_updates.py:1662–1686  ·  view source on GitHub ↗

Parse news entries from CDRH News page.

(self, html: str)

Source from the content-addressed store, hash-verified

1660 return None
1661
1662 def _parse_entries(self, html: str) -> list[dict]:
1663 """Parse news entries from CDRH News page."""
1664 results = []
1665 try:
1666 from bs4 import BeautifulSoup
1667 soup = BeautifulSoup(html, "html.parser")
1668 for link in soup.find_all("a"):
1669 href = link.get("href", "")
1670 text = link.get_text(strip=True)
1671 if not text or len(text) < 10:
1672 continue
1673 if "/medical-devices/" in href and self._PRIORITY_KEYWORDS.search(text):
1674 if href.startswith("/"):
1675 href = "https://www.fda.gov" + href
1676 date_m = re.search(r"(\d{2}/\d{2}/\d{4})", text)
1677 date_str = date_m.group(1) if date_m else ""
1678 results.append({
1679 "title": text,
1680 "date": date_str,
1681 "link": href,
1682 "type": "CDRH News",
1683 })
1684 except ImportError:
1685 results = self._parse_entries_regex(html)
1686 return results
1687
1688 def _parse_entries_regex(self, html: str) -> list[dict]:
1689 """Fallback regex parser."""

Callers 1

checkMethod · 0.95

Calls 3

_parse_entries_regexMethod · 0.95
getMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected