mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix: Make OpenAI Image Scraping More Fault Tolerant (#3749)
This commit is contained in:
parent
20b1b3de35
commit
22fc29742a
@ -257,7 +257,10 @@ class RecipeScraperOpenAI(RecipeScraperPackage):
|
||||
if not width or not height:
|
||||
continue
|
||||
|
||||
try:
|
||||
size = int(width) * int(height)
|
||||
except (ValueError, TypeError):
|
||||
size = 1
|
||||
if size > max_size:
|
||||
max_size = size
|
||||
largest_img = img
|
||||
@ -273,7 +276,10 @@ class RecipeScraperOpenAI(RecipeScraperPackage):
|
||||
text = soup.get_text(separator="\n", strip=True)
|
||||
if not text:
|
||||
raise Exception("No text found in HTML")
|
||||
try:
|
||||
image = self.find_image(soup)
|
||||
except Exception:
|
||||
image = None
|
||||
|
||||
components = [f"Convert this content to JSON: {text}"]
|
||||
if image:
|
||||
|
Loading…
x
Reference in New Issue
Block a user