


def launch_fox_rss():
    from flask import Flask
    import feedparser
    import threading
    import webbrowser
    from time import sleep

    app = Flask(__name__)

    def open_browser():
        sleep(1.5)
        webbrowser.open_new_tab("http://127.0.0.1:5000")

    @app.route("/")
    def rss():
        url = "https://moxie.foxnews.com/google-publisher/latest.xml"
        feed = feedparser.parse(url)
        items = feed.entries[:10]

        html = """
        <html>
        <head>
        <title>Fox News</title>
        <style>
            body {
                background:#111;
                color:#eee;
                font-family:Arial;
                padding:40px;
                text-align:center;
            }
            .item {
                margin:30px auto;
                padding:20px;
                background:#222;
                border-radius:8px;
                width:600px;
            }
            .title {
                color:#99d8ff;
                font-size:55px;
                line-height:1.4;
                word-wrap:break-word;
                white-space:normal;
            }
            .date {
                font-size:45px;
                color:#ccc;
                margin-top:10px;
            }
        </style>
        </head>
        <body>
        <h1 style="font-size:50px;">Fox News</h1>
        """
        for i in items:
            html += f"""
            <div class="item">
                <a class="title" href="{i.link}" target="_blank">{i.title}</a>
                <div class="date">{i.published if 'published' in i else ''}</div>
            </div>
            """
        html += "</body></html>"
        return html

    threading.Thread(target=open_browser).start()
    app.run(port=5000, debug=True)
    
    
    
   
   
launch_fox_rss() 
   
   
   
   