Skip to main content

Reel Mode

Reel mode offers a "TikTok-style" vertical video feed for educational content using YouTube Shorts.

Services

search_youtube_reels(topic, max_results=12)

Located in app.modes.reel.services.youtube_search.

  • Function: Searches YouTube API for "short" videos matching the topic.
  • Filtering: Appends #shorts to the query to target vertical videos.
  • Privacy: Automatically skips videos marked as private or embeddable: false by the API.

validate_videos_batch(videos)

Located in app.modes.reel.services.validator.

  • Purpose: Youtube's API embeddable flag is often inaccurate. This service performs active validation.
  • Parallel Processing: Uses ThreadPoolExecutor to validate multiple videos concurrently.
  • Checks:
    1. Headers: Checks X-Frame-Options and Content-Security-Policy headers associated with the embed URL.
    2. Direct Test: detailed in test_embed_direct (via embed_checker.py).
  • Result: Returns only the list of videos confirmed to be playable in an iframe.