File size: 787 Bytes
d19fc34
 
 
 
 
 
 
443b5e2
d19fc34
 
 
 
 
 
 
 
 
 
8c62821
 
 
 
 
 
 
3f075a4
8c62821
 
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
27
28
29
import gradio as gr
import feedparser

def fetch_rss(url):
    try:
        feed = feedparser.parse(url)
        items = []
        for entry in feed.entries[:30]:
            items.append({
                "title": entry.get("title", ""),
                "link": entry.get("link", ""),
                "pubDate": entry.get("published", ""),
                "description": entry.get("summary", "")
            })
        return items
    except Exception as e:
        return [{"title": "Error", "link": "", "pubDate": "", "description": str(e)}]

# Hidden Gradio endpoint to serve backend requests only
demo = gr.Interface(
    fn=fetch_rss,
    inputs=gr.Textbox(),
    outputs=gr.JSON(),
    live=False
)

# Launch with share=False to avoid exposing frontend
demo.launch(share=False)