Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
import feedparser
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
feed_url = "https://
|
| 6 |
feed = feedparser.parse(feed_url)
|
| 7 |
|
| 8 |
if not feed.entries:
|
| 9 |
-
return "Không tìm thấy tin tức nào từ
|
| 10 |
|
| 11 |
-
result = "# Tin tức
|
| 12 |
for i, entry in enumerate(feed.entries[:5]):
|
| 13 |
title = entry.title
|
| 14 |
link = entry.link
|
|
@@ -18,9 +18,9 @@ def get_latest_rss_news():
|
|
| 18 |
return result
|
| 19 |
|
| 20 |
gr.Interface(
|
| 21 |
-
fn=
|
| 22 |
inputs=None,
|
| 23 |
outputs="markdown",
|
| 24 |
-
title="Tin tức
|
| 25 |
-
description="
|
| 26 |
-
).launch()
|
|
|
|
| 1 |
import feedparser
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def get_yahoo_news_from_google():
|
| 5 |
+
feed_url = "https://news.google.com/rss/search?q=site:finance.yahoo.com&hl=en-US&gl=US&ceid=US:en"
|
| 6 |
feed = feedparser.parse(feed_url)
|
| 7 |
|
| 8 |
if not feed.entries:
|
| 9 |
+
return "Không tìm thấy tin tức nào từ Google News RSS."
|
| 10 |
|
| 11 |
+
result = "# Tin tức Yahoo Finance mới nhất (qua Google News)\n\n"
|
| 12 |
for i, entry in enumerate(feed.entries[:5]):
|
| 13 |
title = entry.title
|
| 14 |
link = entry.link
|
|
|
|
| 18 |
return result
|
| 19 |
|
| 20 |
gr.Interface(
|
| 21 |
+
fn=get_yahoo_news_from_google,
|
| 22 |
inputs=None,
|
| 23 |
outputs="markdown",
|
| 24 |
+
title="Tin tức Yahoo Finance (Realtime qua Google News)",
|
| 25 |
+
description="Hiển thị 5 tin mới nhất từ Yahoo Finance thông qua Google News RSS — cập nhật cực nhanh, không cần nhập gì."
|
| 26 |
+
).launch()
|