import os import re import sys import time import subprocess import threading print("======================================================================") print(" ⚙️ [1/3] Preparando servidor de alta velocidad (1.000 Mbps) en Google...") print("======================================================================") subprocess.run("pkill -f panel_app.py || true; pkill -f cloudflared || true", shell=True) subprocess.run("(apt-get update -qq && apt-get install -y -qq unrar p7zip-full ffmpeg) > /dev/null 2>&1", shell=True) subprocess.run([sys.executable, "-m", "pip", "install", "-q", "flask", "beautifulsoup4", "curl_cffi", "yt-dlp", "playwright"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False) subprocess.run([sys.executable, "-m", "playwright", "install", "--with-deps", "chromium"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False) subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U", "--no-deps", "yt-dlp"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False) if not os.path.exists("/tmp/cloudflared"): subprocess.run("wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /tmp/cloudflared && chmod +x /tmp/cloudflared", shell=True) print(" ⚙️ [2/3] Descargando motor actualizado (MediaFire + PelixPlay HD)...") subprocess.run("curl -sL 'https://huggingface.co/datasets/visionhdstream/data-vision-01/resolve/main/_panel_app.py?t=" + str(int(time.time())) + "' -o /tmp/panel_app.py", shell=True) proc_app = subprocess.Popen( [sys.executable, "/tmp/panel_app.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True ) def _drain_app_logs(): for line in proc_app.stdout: pass threading.Thread(target=_drain_app_logs, daemon=True).start() time.sleep(2) print(" ⚙️ [3/3] Generando enlace web directo al Panel...") proc_cf = subprocess.Popen( ["/tmp/cloudflared", "tunnel", "--url", "http://127.0.0.1:5050"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True ) public_url = None start_wait = time.time() for line in proc_cf.stdout: if not public_url: m = re.search(r"https://[a-zA-Z0-9-]+\.trycloudflare\.com", line) if m: public_url = m.group(0) if public_url and ("Registered tunnel connection" in line or "Connection" in line): break if time.time() - start_wait > 25: break def _drain_cf_logs(): for line in proc_cf.stdout: pass threading.Thread(target=_drain_cf_logs, daemon=True).start() time.sleep(4) print("\n" + "=" * 72) print(" 🚀 ¡PANEL MEDIA SERVER PRO + PELIXPLAY HD ACTIVO EN GOOGLE CLOUD!") print(" 👉 HACÉ CLIC EN ESTE LINK AZUL PARA ABRIR TU PANEL:") print(f"\n {public_url}\n") print(" (Dejá esta pestaña de Google Colab abierta mientras uses el panel)") print("=" * 72 + "\n") try: while True: time.sleep(10) except KeyboardInterrupt: print("Panel detenido.")