hi i'm using streamlit to take input from user and using GoogleNews module i'm searching news related to the input text and storing them in a variable "result_0".. but i want the bellow steps to finish before continuing
googlenews.search(inputt.iloc[0,0])
googlenews.get_news(inputt.iloc[0,0])
result_0 = googlenews.page_at(1)
but in fact whats happening is that the system is going directly to the next line which is :
if len(result_0) == 0:
and its always true because result didn't get the chance to load the news from previous step i tried using time.sleep() function but i'm not sure how long does the step take since the number of news depends on the input text
The problem is how you are using the GoogleNews package. Here is the code to show news by term in a streamlit app using GoogleNews:
Here is the output:
Also I would suggest you use the GNews package instead because it has better functionality. Here is the code to show news by term in a streamlit app using GNews:
Here is the output: