File size: 946 Bytes
1b9f5de
7a459d6
 
a62cfa9
 
1b9f5de
666a17d
1b9f5de
a62cfa9
6878fa9
a62cfa9
71aaf79
1b9f5de
 
 
 
09d58c7
1b9f5de
6878fa9
1b9f5de
a62cfa9
6878fa9
 
a62cfa9
71aaf79
a62cfa9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import feedparser
import gradio as gr

def get_yahoo_news_from_google():
    feed_url = "https://news.google.com/rss/search?q=site:finance.yahoo.com&hl=en-US&gl=US&ceid=US:en"
    feed = feedparser.parse(feed_url)

    if not feed.entries:
        return "Không tìm thấy tin tức nào từ Google News RSS."

    result = "# Tin tức Yahoo Finance mới nhất (qua Google News)\n\n"
    for i, entry in enumerate(feed.entries[:25]):
        title = entry.title
        link = entry.link
        published = entry.published
        result += f"**{i+1}. [{title}]({link})**  \n<sub>{published}</sub>\n\n"

    return result

gr.Interface(
    fn=get_yahoo_news_from_google,
    inputs=None,
    outputs="markdown",
    title="Tin tức Yahoo Finance (Realtime qua Google News)",
    description="Hiển thị 25 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ì."
).launch()