nick5363 commited on
Commit
a62cfa9
·
verified ·
1 Parent(s): 8a1284a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import feedparser
2
  import gradio as gr
3
 
4
- def get_latest_rss_news():
5
- feed_url = "https://finance.yahoo.com/topic/latest-news/"
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ừ Yahoo RSS."
10
 
11
- result = "# Tin tức Mới nhất từ Yahoo Finance (RSS)\n\n"
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=get_latest_rss_news,
22
  inputs=None,
23
  outputs="markdown",
24
- title="Tin tức Mới nhất từ Yahoo (RSS)",
25
- description="Tự động hiển thị 5 tin tài chính/kỹ thuật/macro mới nhất từ Yahoo Finance không cần nhập gì."
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()