fix rss script pixabay

main
Shane 7 months ago
parent 5cd45cf67f
commit 3b1b030025
  1. 7
      foodie_utils.py

@ -1304,7 +1304,7 @@ def get_image(search_query):
logger.info(f"Skipping Pixabay image with too much text: {image_url} ({word_count} words)") logger.info(f"Skipping Pixabay image with too much text: {image_url} ({word_count} words)")
return None return None
return img_url, source_name, uploader, page_url return image_url, source_name, page_url, width, height
except Exception as e: except Exception as e:
logger.warning(f"Failed to process Pixabay image {image_url}: {e}") logger.warning(f"Failed to process Pixabay image {image_url}: {e}")
return None return None
@ -1327,10 +1327,11 @@ def get_image(search_query):
# Process the image for watermarks and resolution # Process the image for watermarks and resolution
result = process_image(img_url, "Pixabay", page_url) result = process_image(img_url, "Pixabay", page_url)
if result: if result:
image_url, source_name, page_url, width, height = result
used_images.add(img_url) used_images.add(img_url)
save_used_images() save_used_images()
logger.info(f"Selected Pixabay image: {img_url} by {uploader} for query '{query}' ({result[0].split('x')[0]}x{result[0].split('x')[1]})") logger.info(f"Selected Pixabay image: {img_url} by {uploader} for query '{query}' ({width}x{height})")
return result return image_url, source_name, uploader, page_url
logger.info(f"No valid Pixabay image found for query '{query}'. Trying fallback query.") logger.info(f"No valid Pixabay image found for query '{query}'. Trying fallback query.")
return None, None, None, None return None, None, None, None

Loading…
Cancel
Save