Fallback regex parser.
(self, html: str)
| 1686 | return results |
| 1687 | |
| 1688 | def _parse_entries_regex(self, html: str) -> list[dict]: |
| 1689 | """Fallback regex parser.""" |
| 1690 | results = [] |
| 1691 | link_re = re.compile( |
| 1692 | r'<a[^>]*href="(/medical-devices/[^"]+)"[^>]*>(.*?)</a>', |
| 1693 | re.DOTALL, |
| 1694 | ) |
| 1695 | for m in link_re.finditer(html): |
| 1696 | href = "https://www.fda.gov" + m.group(1) |
| 1697 | title = re.sub(r"<[^>]+>", "", m.group(2)).strip() |
| 1698 | if title and len(title) > 10 and self._PRIORITY_KEYWORDS.search(title): |
| 1699 | results.append({ |
| 1700 | "title": title, |
| 1701 | "date": "", |
| 1702 | "link": href, |
| 1703 | "type": "CDRH News", |
| 1704 | }) |
| 1705 | return results |
| 1706 | |
| 1707 | |
| 1708 | # --------------------------------------------------------------------------- |