Spaces:
Runtime error
Runtime error
Download app.py from Tower20/easyproxy-sky1: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/spaces/Tower20/easyproxy-sky1/resolve/main/app.py
- Command line
-
hf download hf://spaces/Tower20/easyproxy-sky1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Tower20/easyproxy-sky1/resolve/main/app.py
1.52 kB
| from flask import Flask, Response, request | |
| import requests | |
| import re | |
| # Fai molta attenzione a questa riga qui sotto: | |
| app = Flask(name) | |
| CHANNELS = { | |
| "Sky Serie": "https://tv247us.vip/watch/sky-serie/", | |
| "Sky Uno": "https://tv247us.vip/watch/sky-uno-italy/", | |
| "Sky Sport Uno": "https://tv247us.vip/watch/sky-sport-uno-italia/", | |
| "Sky Sport Arena": "https://tv247us.vip/watch/sky-sport-arena-italia/" | |
| } | |
| def get_dynamic_m3u8(page_url): | |
| headers = {'User-Agent': 'Mozilla/5.0', 'Referer': 'https://tv247us.vip/'} | |
| try: | |
| r = requests.get(page_url, headers=headers, timeout=10) | |
| match = re.search(r'(https?://[^\s\'"<>]+?\.m3u8[^\s\'"<>]*?)', r.text) | |
| return match.group(1).replace('\\/', '/') if match else None | |
| except: return None | |
| def home(): | |
| return "Proxy Attivo! Usa /playlist.m3u" | |
| def playlist(): | |
| host = request.host_url.rstrip('/') | |
| m3u = "#EXTM3U\n" | |
| for name in CHANNELS: | |
| m3u += f'#EXTINF:-1, {name}\n{host}/live?id={name}\n' | |
| return Response(m3u, content_type='text/plain') | |
| def live(): | |
| channel_id = request.args.get('id') | |
| target = get_dynamic_m3u8(CHANNELS.get(channel_id)) | |
| if not target: return "Link non trovato", 404 | |
| r = requests.get(target, headers={'Referer': 'https://tv247us.vip/'}, stream=True) | |
| return Response(r.iter_content(chunk_size=1024*10), content_type='application/vnd.apple.mpegurl') | |
| if name == 'main': | |
| app.run(host='0.0.0.0', port=7860) |