FocusTube
Optimized YouTube Learning Environment
The problem FocusTube solves
The Problem:
Students use YouTube to learn but YouTube is built to keep you watching, not learning. There's no study mode, no intent tracking, no accountability. A student opens YouTube to study DSA and 40 minutes later they're watching Silicon Valley or The Imitation Game — not because they're lazy, but because the platform has no concept of their goal.
What FocusTube Solves:
A focused study companion that sits on top of YouTube — you set a goal, it finds the best educational content, tracks your session timer, detects the moment you drift off topic using AI, and quizzes you at the end to reinforce learning
Challenges we ran into
- Stateless backend losing goal context
The biggest one. Every search request was stateless so goal and session_id were undefined on the backend. Gemini had nothing to compare against so classification never fired. Fixed by persisting goal server-side in sessionGoals{} and generating a UUID session_id in localStorage on the frontend. - Gemini analysis silently failing
The catch block only logged err.message — when Gemini returned malformed JSON the error was swallowed completely with no visibility. Fixed by logging the raw Gemini response before parsing and making the JSON extraction non-greedy. - Zero results blocking Gemini
When a query like "taylor swift" returned 0 educational results after filtering, the condition finalResults.length > 0 prevented Gemini from running at all — so off-topic searches never got flagged. Fixed by moving Gemini analysis before the YouTube fetch entirely, making it query-based not result-based. - buildQueryWithGemini polluting searches
An earlier version appended suffixes like "lecture explained tutorial" to every query via Gemini. This hurt result quality and added unnecessary API latency. Removed entirely — raw query now goes straight to YouTube. - MODULE_NOT_FOUND crash on startup
@google/generative-ai was used in quiz.js but not installed in the Backend's node_modules. Fixed with npm install @google/generative-ai in the Backend folder.
Tracks Applied (1)
Google Cloud
Major League Hacking
Technologies used
Discussion
Builders also viewed
See more projects on Devfolio

