Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -169,29 +169,31 @@ def generate_map(location_names):
|
|
169 |
def fetch_local_news():
|
170 |
api_key = os.environ['SERP_API']
|
171 |
url = f'https://serpapi.com/search.json?engine=google_news&q=ohama headline&api_key={api_key}'
|
172 |
-
|
173 |
-
|
174 |
response = requests.get(url)
|
175 |
if response.status_code == 200:
|
176 |
results = response.json().get("news_results", [])
|
177 |
news_html = """
|
178 |
-
<h2 style="font-family:
|
179 |
<style>
|
180 |
.news-item {
|
181 |
-
font-family:
|
182 |
color: #333;
|
|
|
183 |
margin-bottom: 15px;
|
184 |
padding: 10px;
|
185 |
border: 1px solid #ddd;
|
186 |
border-radius: 5px;
|
187 |
-
transition: box-shadow 0.3s ease;
|
|
|
188 |
}
|
189 |
.news-item:hover {
|
190 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
|
191 |
}
|
192 |
.news-item a {
|
193 |
color: #1E90FF;
|
194 |
text-decoration: none;
|
|
|
195 |
}
|
196 |
.news-item a:hover {
|
197 |
text-decoration: underline;
|
@@ -206,7 +208,7 @@ def fetch_local_news():
|
|
206 |
z-index: 1000;
|
207 |
max-width: 300px;
|
208 |
padding: 10px;
|
209 |
-
font-family:
|
210 |
color: #333;
|
211 |
}
|
212 |
</style>
|
@@ -238,18 +240,6 @@ def fetch_local_news():
|
|
238 |
return news_html
|
239 |
else:
|
240 |
return "<p>Failed to fetch local news</p>"
|
241 |
-
# response = requests.get(url)
|
242 |
-
# if response.status_code == 200:
|
243 |
-
# results = response.json().get("news_results", [])
|
244 |
-
# news_html = "<h2>Omaha Today Headline </h2>"
|
245 |
-
# for index, result in enumerate(results[:10]):
|
246 |
-
# title = result.get("title", "No title")
|
247 |
-
# link = result.get("link", "#")
|
248 |
-
# snippet = result.get("snippet", "")
|
249 |
-
# news_html += f"<p>{index + 1}. <a href='{link}' target='_blank'>{title}</a><br>{snippet}</p>"
|
250 |
-
# return news_html
|
251 |
-
# else:
|
252 |
-
# return "<p>Failed to fetch local news</p>"
|
253 |
|
254 |
# Function to fetch local events
|
255 |
def fetch_local_events():
|
|
|
169 |
def fetch_local_news():
|
170 |
api_key = os.environ['SERP_API']
|
171 |
url = f'https://serpapi.com/search.json?engine=google_news&q=ohama headline&api_key={api_key}'
|
|
|
|
|
172 |
response = requests.get(url)
|
173 |
if response.status_code == 200:
|
174 |
results = response.json().get("news_results", [])
|
175 |
news_html = """
|
176 |
+
<h2 style="font-family: 'Georgia', serif; color: #4CAF50; background-color: #f8f8f8; padding: 10px; border-radius: 10px;">Omaha Today Headlines</h2>
|
177 |
<style>
|
178 |
.news-item {
|
179 |
+
font-family: 'Verdana', sans-serif;
|
180 |
color: #333;
|
181 |
+
background-color: #f0f8ff;
|
182 |
margin-bottom: 15px;
|
183 |
padding: 10px;
|
184 |
border: 1px solid #ddd;
|
185 |
border-radius: 5px;
|
186 |
+
transition: box-shadow 0.3s ease, background-color 0.3s ease;
|
187 |
+
font-weight: bold;
|
188 |
}
|
189 |
.news-item:hover {
|
190 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
191 |
+
background-color: #e6f7ff;
|
192 |
}
|
193 |
.news-item a {
|
194 |
color: #1E90FF;
|
195 |
text-decoration: none;
|
196 |
+
font-weight: bold;
|
197 |
}
|
198 |
.news-item a:hover {
|
199 |
text-decoration: underline;
|
|
|
208 |
z-index: 1000;
|
209 |
max-width: 300px;
|
210 |
padding: 10px;
|
211 |
+
font-family: 'Verdana', sans-serif;
|
212 |
color: #333;
|
213 |
}
|
214 |
</style>
|
|
|
240 |
return news_html
|
241 |
else:
|
242 |
return "<p>Failed to fetch local news</p>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
# Function to fetch local events
|
245 |
def fetch_local_events():
|