Finds all anchor tags and parses the href attribute.
(html: str)
| 149 | |
| 150 | |
| 151 | def parse_links(html: str) -> list[str]: |
| 152 | """ |
| 153 | Finds all anchor tags and parses the href attribute. |
| 154 | """ |
| 155 | soup = BeautifulSoup(html, 'html.parser') |
| 156 | tags = soup.find_all('a') |
| 157 | return [tag['href'] for tag in tags if tag.has_attr('href') and validators.url(tag['href'])] |
| 158 | |
| 159 | |
| 160 | def parse_emails(soup: BeautifulSoup) -> list[str]: |