Spaces:
Sleeping
Sleeping
Added settings
Browse files- app.py +12 -1
- wna_googlenews.py +6 -2
app.py
CHANGED
@@ -5,9 +5,20 @@ import wna_googlenews as wna
|
|
5 |
st.title("WNA Google News App")
|
6 |
st.subheader("Search for News")
|
7 |
|
|
|
|
|
|
|
8 |
query = st.text_input("Enter Query")
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
if st.button("Search"):
|
11 |
-
df = wna.get_news(
|
12 |
st.dataframe(df)
|
13 |
|
|
|
5 |
st.title("WNA Google News App")
|
6 |
st.subheader("Search for News")
|
7 |
|
8 |
+
# create a dropdown menu for selecting days range
|
9 |
+
days_range = st.selectbox("Select Days Range", ["1d", "7", "30d"])
|
10 |
+
|
11 |
query = st.text_input("Enter Query")
|
12 |
|
13 |
+
settings = {
|
14 |
+
"lang": "fr",
|
15 |
+
"region": "FR",
|
16 |
+
"period": days_range
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
if st.button("Search"):
|
22 |
+
df = wna.get_news(settings, query)
|
23 |
st.dataframe(df)
|
24 |
|
wna_googlenews.py
CHANGED
@@ -3,8 +3,12 @@ from GoogleNews import GoogleNews
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# get the news with lang and country parameters
|
6 |
-
def get_news(
|
7 |
-
googlenews = GoogleNews(
|
|
|
|
|
|
|
|
|
8 |
googlenews.search(query)
|
9 |
result = googlenews.result()
|
10 |
df = pd.DataFrame(result)
|
|
|
3 |
import pandas as pd
|
4 |
|
5 |
# get the news with lang and country parameters
|
6 |
+
def get_news(settings, query):
|
7 |
+
googlenews = GoogleNews(
|
8 |
+
lang=settings["lang"],
|
9 |
+
region=settings["region"],
|
10 |
+
period=settings["period"],
|
11 |
+
)
|
12 |
googlenews.search(query)
|
13 |
result = googlenews.result()
|
14 |
df = pd.DataFrame(result)
|