A web application that summarizes YouTube videos and allows users to navigate to specific timestamps. The application has a clean, Google-like interface with both frontend and backend components, and uses OpenAI API for generating summaries.
- Input YouTube URLs to get AI-generated summaries
- View summaries with clickable timestamps
- Navigate directly to specific parts of the video
- Responsive design that works on desktop and mobile
- Clean, Google-inspired interface
- Frontend: HTML, CSS, JavaScript
- Backend: Golang with GIN framework
- APIs: OpenAI API
youtube_summarizer/
├── frontend/ # Frontend code
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files
│ └── index.html # Main HTML file
└── backend/ # Backend code
├── main.go # Entry point
├── api/ # API endpoints
├── services/ # Business logic
└── models/ # Data models
- Go 1.20 or higher
- OpenAI API key (set in
.env
file) yt-dlp
installed and accessible in your PATH (see https://github.com/yt-dlp/yt-dlp)
-
Clone this repository.
-
Navigate to the
backend
directory. -
Install dependencies:
go mod tidy pip3 install yt-dlp
-
Run the server using one of these methods:
Using Make (recommended):
make run
Using the shell script:
chmod +x run.sh ./run.sh
Running directly:
cd backend go run main.go
The server will start at http://localhost:8080
The project includes a Makefile for easy management:
# Setup the project (install dependencies, create .env file)
make setup
# Run the application
make run
# Build the application
make build
# Run tests
make test
# Clean build artifacts
make clean
# Show help message
make help
-
POST /api/summary
: Submits a YouTube URL for summarization.- Request:
{ "url": "https://www.youtube.com/watch?v=..." }
- Response (Cached Summary - HTTP 200):
{ "videoId": "...", "title": "...", "summary": "...", "timestamps": [...], "cached": true }
- Response (Job Queued - HTTP 202):
{ "message": "Summarization request received and queued.", "video_id": "..." }
- Note: If a job is queued, clients should connect to the SSE endpoint below for real-time updates.
- Response (Job Already Active - HTTP 202):
{ "message": "Summarization for this video is already in progress. You will be notified upon completion.", "video_id": "..." }
- Response (Error - e.g., HTTP 400, 401, 403, 503):
{ "error": "Error message details" }
- Request:
-
GET /api/summary/events
: Establishes a Server-Sent Events (SSE) connection for real-time updates on summarization jobs.- Authentication: Requires user session (cookie-based).
- Events:
event: summary_complete\ndata: {SummaryResponse JSON}\n\n
event: summary_error\ndata: {"videoId": "...", "error": "Error message"}\n\n
-
GET /user/info
: Retrieves information about the currently authenticated user. -
GET /user/api-key-status
: Checks if the current user needs to provide their own API key. -
GET /api/user-recent-summaries
: Fetches a list of recently summarized videos for the authenticated user. -
/auth/google
(GET): Initiates Google OAuth login. -
/auth/logout
(POST): Logs out the current user.
- Open the application in your browser
- Paste a YouTube URL in the search box
- Click "Summarize" to generate a summary
- View the summary with clickable timestamps
- Click on timestamps to navigate to specific parts of the video
- The application requires the YouTube video to have captions/transcripts available
- Very long videos may result in less detailed summaries due to token limitations
- The quality of the summary depends on the clarity and quality of the video transcript
- Add support for multiple languages
- Implement caching for previously summarized videos
- Add more customization options for summaries
- Support for playlists and channels