Skip to content

Repository files navigation

StudyTube

Turn a YouTube topic into a fast study tool: search and tag the best videos, get an AI summary/notes/quiz for any one video, or synthesize a full multi-module course from a topic's videos - each module linked back to the exact video and timestamp that explains it.

Features

  • Discovery - search a topic, see ~20 ranked videos with metadata, auto-generated topic tags, and sort/filter (views, length, captions).
  • Study - paste a video URL/ID (or pick one from Discovery) to get an AI summary, key points/terms, and a scored 8–10 question quiz, grounded only in that video's transcript.
  • Course - turn a topic's videos into a 10–12 module course with per-module overviews, key ideas, checkpoint quizzes, and "watch the source" links that open the right video at the right timestamp.

Setup

  1. Python 3.11+, then install dependencies:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  2. Get a YouTube Data API v3 key: in the Google Cloud Console, create a project, enable "YouTube Data API v3" under APIs & Services, then create an API key under Credentials.

  3. Get an Anthropic API key: create one at console.anthropic.com.

  4. Add both keys to .streamlit/secrets.toml (already gitignored). Copy the template and fill it in:

    cp .streamlit/secrets.toml.example .streamlit/secrets.toml
    YOUTUBE_API_KEY = "..."ANTHROPIC_API_KEY = "..."
  5. Run it:

    streamlit run app.py

Hosting caveat: transcripts on Streamlit Community Cloud

YouTube blocks transcript requests from cloud-provider IP ranges (AWS/GCP/Azure — which Streamlit Community Cloud runs on). Search and Claude calls work fine hosted; only transcript fetching (and therefore Study/Course) is affected.

  • Running locally → everything works, no proxy needed.
  • Hosted → add a rotating residential proxy (the app supports Webshare out of the box) by setting WEBSHARE_PROXY_USERNAME / WEBSHARE_PROXY_PASSWORD in the deployed app's Secrets. Without them, search and tagging still work, but Study/Course will show a clear "transcript unavailable" message instead of crashing.

To deploy: push this repo to GitHub (without secrets.toml — confirm .gitignore excludes it), connect it at share.streamlit.io, and paste your keys into the app's Secrets box (same key = "value" TOML format as secrets.toml).

Project layout

app.py # entry point: sidebar nav + view routing via session_state
services/
youtube.py # search() + video metadata via YouTube Data API
transcript.py # get_transcript() / get_transcript_with_timestamps(), proxy-aware
llm.py # Anthropic client, call_llm(), safe_json(), long-transcript condensing
tagging.py # per-video topic tags (chapters + LLM)
study.py # study_materials(transcript) -> summary/notes/quiz
course.py # build_course(topic, videos) -> 10-12 module course (map-reduce)
components/
video_card.py # one search-result card
quiz.py # interactive scored quiz, shared by Study and Course
course_view.py # module rail + progress + checkpoint quizzes + source links

Notes

  • Search results, transcripts, study materials, tags, and courses are all cached (@st.cache_data), so re-running a search or revisiting a module never re-spends API quota or re-bills the LLM.
  • The course-building flagship feature needs at least 3 videos with usable transcripts; if fewer are available it reports not_enough_transcripts instead of guessing.
  • There's no database — session state + caching is enough. Streamlit Community Cloud's filesystem is ephemeral anyway, so nothing here relies on writing to disk.

About

StudyTube - Turn a YouTube topic into a fast study tool: search and tag the best videos, get an AI summary/notes/quiz for any one video, or synthesize a full multi-module course from a topic's videos - each module linked back to the exact video and timestamp that explains it.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages