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{published}\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()