(soup: BeautifulSoup)
| 39 | |
| 40 | |
| 41 | def extract_primary_image(soup: BeautifulSoup) -> str: |
| 42 | default_image_url = DefaultIcons.ARTICLE_ICON_SVG |
| 43 | image = soup.find('meta', property='og:image') |
| 44 | if image and image.get('content'): |
| 45 | return image['content'] |
| 46 | image = soup.find('img') |
| 47 | if image and image.get('src'): |
| 48 | return image['src'] |
| 49 | return default_image_url # Return a default image URL if no image is found |
| 50 | |
| 51 | |
| 52 | def extract_publisher(soup: BeautifulSoup, url: str) -> str: |
no outgoing calls
no test coverage detected