Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import yt_dlp | |
| st.set_page_config(page_title="YT Downloader", page_icon="🎥") | |
| st.title("🎥 YouTube Downloader") | |
| url = st.text_input("Enter YouTube URL:", placeholder="https://www.youtube.com/watch?v=...") | |
| if url: | |
| try: | |
| with st.spinner("Fetching video info..."): | |
| ydl_opts = {'format': 'best', 'quiet': True} | |
| with yt_dlp.YoutubeDL(ydl_opts) as ydl: | |
| info = ydl.extract_info(url, download=False) | |
| st.subheader(info.get('title')) | |
| st.image(info.get('thumbnail'), width=400) | |
| video_url = info.get('url') | |
| if video_url: | |
| st.video(video_url) | |
| st.link_button("Download Video", video_url) | |
| except Exception as e: | |
| st.error(f"Error: {e}") |