import streamlit as st import yt_dlp import os import time import socket # --- KONFIGURASI HALAMAN --- st.set_page_config(page_title="VDown", page_icon="⚡", layout="centered") # --- CSS --- st.markdown(""" """, unsafe_allow_html=True) st.title("⚡ VDown Simple") # --- DEBUGGING JARINGAN (Untuk Cek Status) --- try: # Cek apakah server punya internet socket.gethostbyname("google.com") st.success("✅ Status Server: Online (Terhubung ke Internet)") except: st.error("❌ Status Server: OFFLINE (Internet Diblokir Hugging Face)") url = st.text_input("Link Video:", placeholder="https://...") if st.button("Proses Video"): if not url: st.warning("Isi link dulu.") else: status = st.empty() status.info("Sedang memproses...") try: # Opsi Anti-Blokir ydl_opts = { 'format': 'best', 'quiet': True, 'no_warnings': True, 'force_ipv4': True, # Paksa IPv4 'nocheckcertificate': True,# Abaikan SSL Error 'socket_timeout': 10, # Timeout pendek # Header samaran 'http_headers': { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', } } with yt_dlp.YoutubeDL(ydl_opts) as ydl: info = ydl.extract_info(url, download=False) # Tampilkan Hasil status.empty() st.image(info.get('thumbnail')) st.subheader(info.get('title')) st.link_button("⬇️ Download Sekarang", info.get('url')) except Exception as e: status.empty() st.error(f"Gagal: {e}") st.write("Tips: Jika Status Server OFFLINE, berarti akun ini sudah diblokir jaringannya. Silakan coba platform lain.")