File size: 3,860 Bytes
53ecad3
 
 
 
 
 
0747cf4
2de8456
2758e54
93eccd0
789f9ad
bddf821
9afa327
03c2b26
9c35954
fb754cd
164e636
a82e049
26f6335
a43d82f
688c6c4
3b1c7bb
03c2b26
53ecad3
4239df3
 
5fea19f
54433e6
03c2b26
ad53462
7be1090
53ecad3
 
 
 
 
 
a9d8f21
53ecad3
 
a9d8f21
53ecad3
 
 
 
 
 
 
 
 
 
 
 
 
 
a9d8f21
f8cec2c
1d951f7
53ecad3
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import requests
import feedparser
import gradio as gr

# Define the RSS feed URLs
news_sources = {
    "SM+": "https://cdn.mysitemapgenerator.com/shareapi/rss/0703926003",
    "Ad •Assetmart• on Telegram":  "http://bit.ly/4hTmAG",
    "ABP News": "https://www.abplive.com/home/feed",
    "Axiom Article 🆕 Spin-Up a professional article. Sponsored in part by SM+": "https://t.me/SMPlusSevenCities_Bot/AxiomArticle",
    "Bitcoin Strategic Reserve News": "https://cdn.mysitemapgenerator.com/shareapi/rss/2502907090",
    "BRICS Currency News": "http://fetchrss.com/rss/67bca52dda01b8237d0cd46367bcea7171f66470280b2d72.xml",
    "Ad •Shopify 👜 Fash/ Wherehouse™ 🆕": "https://cdn.mysitemapgenerator.com/shareapi/gmc/07036258915_185",
    "Business Line": "https://www.thehindubusinessline.com/feeder/default.rss",
    "Fashionista 👗 Elevate 🆕 Your Wardrobe Today #fab": "https://cdn.mysitemapgenerator.com/shareapi/gmc/07036258906_169",
    "Futures Crypto (Trading View) Sponsored in part by SM+ 🤑": "https://politepol.com/fd/eg8zlQt2YgLU.xml",
    "Gaby Sprugs 🤖 Nano 🆕 🤓": "https://cdn.mysitemapgenerator.com/shareapi/rss/0703926113",
    "iHeadline Influencers 🤓": "https://cdn.mysitemapgenerator.com/shareapi/rss/0703926003",
    "+ - Neutral 🆕🗞️ Artical Sentiment Analysis sponsored in part by SM+": "https://t.me/SMPlusSevenCities_Bot/plusminusorneutral",
    "India Today": "https://www.indiatoday.in/rss/home",
    "Indian Express": "https://indianexpress.com/section/india/feed",
    "K-Verse News 🆕": "https://politepol.com/fd/H1MU8Bk3wbVU.xml",
    "Live Mint": "https://www.livemint.com/rss/news",
    "Money Control": "https://www.moneycontrol.com/rss/latestnews.xml",
    "NDTV": "https://feeds.feedburner.com/NDTV-LatestNews",
    "News 18": "https://www.news18.com/commonfeeds/v1/eng/rss/india.xml",
    "Shipping 🚢 Industry News SMPLUS20 🆕 Econ Indicators- California. Sponsored by SM Plus (SM+)": "https://feedfry.com/rss/11eff3c1ffb32b90aa788bf3027792d8",
    "SM+ Curated Content, Movies and more 🆕 🤓🍿": "https://cdn.mysitemapgenerator.com/shareapi/rss/0703926003",
    "The Federal": "https://thefederal.com/feeds.xml",
    "Tik Tok News 🤓 Feed sponsored by SM+": "https://feedfry.com/rss/11eff2ff9439b661aee1d6bffcf7993f",
    "#UN #Housing #Celebrity #News #CryptoNews #Futures #Spring #2025 #Entertainment #Streaming #GoldCard #Framework #gaming #Pokemon #Tariffs #EggPrices #SpringVibes": "https://feedfry.com/rss/11eff3059298fa75b1de4c8eb41bf065"
}
# Function to fetch and parse RSS feeds
def fetch_news(source):
    try:
        feed = feedparser.parse(requests.get(source).content)
        news_items = [
            f"<a href='{entry.link}' target='_blank'>{entry.title}</a>"
            for entry in feed.entries[:10]  # Fetch top 10 headlines
        ]
        return "<br><br>".join(news_items) if news_items else "No news available."
    except Exception as e:
        return f"Error fetching news: {str(e)}"

# Gradio interface function
def display_news(selected_source):
    source_url = news_sources[selected_source]
    headlines = fetch_news(source_url)
    return headlines

# Create Gradio interface
def create_interface():
    interface = gr.Interface(
        fn=display_news,
        inputs=gr.Dropdown(choices=list(news_sources.keys()), label="Select News Source"),
        outputs=gr.HTML(label="Top Headlines"),
        title="LIVE News / feeds",
        description="Select a news source from the dropdown to view its latest headlines with clickable links.  SM+ may receive earnings/commissions from affiliate links. iHeadline 1.030 {} Mod is a California Joint Venture Partnership between SM Plus Seven Cities & SM Plus (SM+)"
    )
    return interface

# Deploy Gradio app
if __name__ == "__main__":
    app = create_interface()
    app.launch()