diff --git a/alwrity.py b/alwrity.py index 273a72ee..c5d9e1b3 100644 --- a/alwrity.py +++ b/alwrity.py @@ -432,7 +432,60 @@ def content_planning_tools(): choice = st.radio("Select a content planning tool:", options, index=0, format_func=lambda x: f"🔍 {x}") if choice == "Keywords Researcher": - do_web_research() + st.title("Web Research Assistant") + st.write("Enter keywords for web research. The keywords should be at least three words long.") + + search_keywords = st.text_input("Search Keywords", placeholder="Enter keywords for web research...") + if st.button("Start Web Research"): + if search_keywords and len(search_keywords.split()) >= 3: + try: + st.info(f"Starting web research on given keywords: {search_keywords}") + with st.spinner("Performing web research..."): + # Fetch and display multirange interest over time + st.subheader("Multirange Interest Over Time") + multirange_data = fetch_multirange_interest_over_time([search_keywords], ['today 3-m', 'today 1-m']) + st.dataframe(multirange_data) + + # Fetch and display historical hourly interest + st.subheader("Historical Hourly Interest") + hourly_data = fetch_historical_hourly_interest([search_keywords], '2023-01-01', '2023-01-31') + st.dataframe(hourly_data) + + # Fetch and display trending searches + st.subheader("Trending Searches") + trending_data = fetch_trending_searches() + st.dataframe(trending_data) + + # Fetch and display realtime search trends + st.subheader("Realtime Search Trends") + realtime_data = fetch_realtime_search_trends() + st.dataframe(realtime_data) + + # Fetch and display top charts + st.subheader("Top Charts") + top_charts_data = fetch_top_charts(2023) + st.dataframe(top_charts_data) + + # Fetch and display suggestions + st.subheader("Suggestions") + suggestions = fetch_suggestions(search_keywords) + st.dataframe(pd.DataFrame(suggestions)) + + # Example of plotting with Matplotlib + st.subheader("Interest Over Time Plot") + plt.figure(figsize=(10, 6)) + plt.plot(multirange_data['date'], multirange_data[search_keywords], label=search_keywords) + plt.title(f'Interest Over Time for "{search_keywords}"') + plt.xlabel('Date') + plt.ylabel('Interest') + plt.legend() + st.pyplot(plt) + + st.success("Web research completed successfully!") + except Exception as err: + st.error(f"ERROR: Failed to do web research: {err}") + else: + st.warning("Search keywords should be at least three words long. Please try again.") elif choice == "Competitor Analysis": competitor_analysis() elif choice == "Content Calender Ideator":