From 31c8defc4aabd1ed33f67b9796e2b2fb341acdb1 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 30 Apr 2025 18:50:32 +1000 Subject: [PATCH] update geos google script --- foodie_automator_google.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/foodie_automator_google.py b/foodie_automator_google.py index 9d80eb9..336f2c6 100644 --- a/foodie_automator_google.py +++ b/foodie_automator_google.py @@ -178,18 +178,23 @@ def fetch_duckduckgo_news_context(trend_title, hours=24): logging.warning(f"DuckDuckGo News context fetch failed for '{trend_title}': {e}") return trend_title -def curate_from_google_trends(): - # Fetch Google Trends data - trends = fetch_google_trends() - if not trends: +def curate_from_google_trends(geo_list=['US']): + # Fetch Google Trends data for each geo + all_trends = [] + for geo in geo_list: + trends = scrape_google_trends(geo=geo) + if trends: + all_trends.extend(trends) + + if not all_trends: print("No Google Trends data available") logging.info("No Google Trends data available") return None, None, None attempts = 0 max_attempts = 10 - while attempts < max_attempts and trends: - trend = trends.pop(0) + while attempts < max_attempts and all_trends: + trend = all_trends.pop(0) title = trend["title"] link = trend.get("link", "https://trends.google.com/") summary = trend.get("summary", "")