MCPcopy Create free account
hub / github.com/clockworknowledge/menome_processor / extract_primary_image

Function extract_primary_image

app/routers/document.py:41–49  ·  view source on GitHub ↗
(soup: BeautifulSoup)

Source from the content-addressed store, hash-verified

39
40
41def 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
52def extract_publisher(soup: BeautifulSoup, url: str) -> str:

Callers 2

extract_thumbnailFunction · 0.85
add_documentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected