WIP- Try AI-Writer and Web research; working. Working on usuability aspects.

This commit is contained in:
AjaySi
2024-03-02 08:52:42 +05:30
parent a87a87a620
commit 87053406ba
14 changed files with 162 additions and 108 deletions

View File

@@ -182,7 +182,10 @@ def get_related_topics_and_save_csv(search_keywords):
pytrends.build_payload(search_keywords, cat=0, timeframe='today 12-m')
# Get related topics
data = pytrends.related_topics()
try:
data = pytrends.related_topics()
except Exception as err:
logger.error(f"Failed to get pytrends realted topics: {err}")
# Extract data from the result
top_topics = list(data.values())[0]['top']
rising_topics = list(data.values())[0]['rising']
@@ -215,7 +218,7 @@ def get_related_topics_and_save_csv(search_keywords):
return all_topics_df
except Exception as e:
print(f"ERROR: An error occurred in related topics: {e}")
logger.error(f"ERROR: An error occurred in related topics: {e}")
return pd.DataFrame()