Skip to content

euisuk-chung/streamlit-video-snap

Repository files navigation

YouTube Tools

A local Streamlit application that provides YouTube video tools: thumbnail downloader and audio extractor.

Features

  • πŸ“Έ Thumbnail Downloader

    • Download high-quality thumbnails (up to 1920x1080)
    • Multiple quality options (Max, High, Medium, Standard)
    • Direct download links for each quality
  • 🎡 Audio Extractor

    • Extract audio from YouTube videos
    • Play audio directly in the browser
    • Display video metadata (title, duration, views, etc.)
    • Download audio files
  • 🐳 Docker-based Backend

    • yt-dlp API server running in Docker
    • Easy setup and deployment
  • πŸ’» Simple Streamlit UI

    • Clean tabbed interface
    • Real-time API status check

Architecture

  • Frontend: Streamlit web application
  • Backend: Flask API server running yt-dlp in Docker
  • Audio Extraction: yt-dlp with ffmpeg

Setup

Prerequisites

  • Python 3.8+
  • uv (recommended) or pip
  • Docker and Docker Compose
  • Git

Installation

  1. Clone the repository:
git clone <your-repo-url>
cd streamlit-video-snap
  1. Install Python dependencies:

Using uv (recommended):

uv sync

Using pip:

pip install -r requirements.txt
  1. Start the yt-dlp Docker server:
cd ytdlp-server
docker-compose up -d
cd ..
  1. Verify the API server is running:
curl http://localhost:8080/health

You should see: {"service":"yt-dlp-api","status":"ok"}

Running the Application

Using uv (recommended):

uv run streamlit run app.py

Using pip:

streamlit run app.py

Then open your browser to: http://localhost:8501

Usage

Thumbnail Downloader

  1. Switch to the "πŸ“Έ Thumbnail Downloader" tab
  2. Enter a YouTube video URL
  3. Click "Get Thumbnail"
  4. View thumbnails in multiple qualities
  5. Click download links to save thumbnails

Audio Extractor

  1. Switch to the "🎡 Audio Extractor" tab
  2. Enter a YouTube video URL
  3. Click "Extract Audio"
  4. View video information and metadata
  5. Play the audio directly in your browser
  6. Download the audio file if needed

API Endpoints

The yt-dlp server provides the following endpoints:

  • GET /health - Health check
  • POST /api/info - Get video metadata
  • POST /api/audio - Extract audio information and URL

Auto-Start on Windows Boot

PC λΆ€νŒ… μ‹œ μžλ™μœΌλ‘œ μ„œλ²„λ“€μ΄ μ‹€ν–‰λ˜λ„λ‘ μ„€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

ν˜„μž¬ μƒνƒœ

μ„œλ²„ μžλ™ μ‹€ν–‰ μ„€λͺ…
Backend (Docker) O restart: unless-stopped 섀정됨
Frontend (Streamlit) O Windows μ‹œμž‘ ν”„λ‘œκ·Έλž¨μ— 등둝됨

μžλ™ μ‹€ν–‰ ꡬ쑰

  • Backend: Docker Desktop이 λΆ€νŒ… μ‹œ μžλ™ μ‹œμž‘λ˜λ©΄, unless-stopped μ •μ±…μœΌλ‘œ μ»¨ν…Œμ΄λ„ˆλ„ μžλ™ μ‹œμž‘
  • Frontend: start-streamlit.bat 파일이 Windows μ‹œμž‘ ν”„λ‘œκ·Έλž¨μ— λ“±λ‘λ˜μ–΄ μžλ™ μ‹€ν–‰

μžλ™ μ‹€ν–‰ 관리

μ‹œμž‘ ν”„λ‘œκ·Έλž¨ 등둝 (졜초 μ„€μ • μ‹œ)

powershell -ExecutionPolicy Bypass -File create-shortcut.ps1

μ‹œμž‘ ν”„λ‘œκ·Έλž¨ ν•΄μ œ

Windows μ‹œμž‘ ν”„λ‘œκ·Έλž¨ ν΄λ”μ—μ„œ λ°”λ‘œκ°€κΈ° μ‚­μ œ:

Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\YouTube-Tools-Streamlit.lnk"

λ˜λŠ” Win + R β†’ shell:startup β†’ YouTube-Tools-Streamlit.lnk μ‚­μ œ

μ‹œμž‘ ν”„λ‘œκ·Έλž¨ 폴더 μ—΄κΈ°

Win + R β†’ shell:startup

κ΄€λ ¨ 파일

파일 μ„€λͺ…
start-streamlit.bat Streamlit μ‹€ν–‰ 배치 파일
create-shortcut.ps1 μ‹œμž‘ ν”„λ‘œκ·Έλž¨ 등둝 슀크립트

Troubleshooting

API Server Not Running

If the sidebar shows "API Server is not running":

cd ytdlp-server
docker-compose up -d
docker-compose logs

Docker Container Issues

Check container status:

docker ps
docker logs ytdlp-server

Restart the container:

cd ytdlp-server
docker-compose restart

Audio Playback Issues

Some audio formats may not play directly in the browser. Try downloading the audio file instead using the provided link.

Development

Project Structure

streamlit-video-snap/
β”œβ”€β”€ app.py                  # Main Streamlit application
β”œβ”€β”€ pyproject.toml         # Project configuration and dependencies (uv)
β”œβ”€β”€ requirements.txt        # Python dependencies (pip)
β”œβ”€β”€ .python-version        # Python version specification
β”œβ”€β”€ README.md              # This file
└── ytdlp-server/          # Docker-based yt-dlp API
    β”œβ”€β”€ app.py             # Flask API server
    β”œβ”€β”€ Dockerfile         # Docker image definition
    └── docker-compose.yml # Docker compose configuration

Stopping the Application

  1. Stop Streamlit: Press Ctrl+C in the terminal

  2. Stop Docker container:

cd ytdlp-server
docker-compose down

License

MIT

Notes

  • This is a local-only application (not deployed to cloud)
  • Audio extraction may take a few seconds depending on the video
  • Some videos may be blocked due to geographic restrictions or copyright
  • The extracted audio URL is temporary and expires after some time

About

Streamlit based Video Info Retriever

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages