A Chrome extension that extracts YouTube transcripts and generates concise, structured summaries using an optional local Flask backend powered by OpenAI.
- Extracts captions/transcripts from YouTube videos (multiple strategies, with fallbacks)
- Sends transcript, title, and metadata to a local API for AI-generated summaries
- Displays a readable summary with key points in the popup/side panel
- Caches results in a MySQL database (optional, via the backend)
- Simple setup: load the extension unpacked; optional Python backend
- Google Chrome (or Chromium-based browser) with Extension Developer Mode
- Optional Backend (recommended for AI summaries):
- Python 3.10+
- OpenAI API key
- MySQL (optional, for caching)
manifest.json: Extension manifestcontent/: Content script that runs on YouTube pages and extracts transcriptspopup/: Popup UI (when clicking the extension icon)sidepanel/: Side panel UI (optional; opens from the extension icon)background/: Service worker handling API calls and coordinationapi/: Optional Flask backend using OpenAI and (optionally) MySQL for caching
- Clone or download this repository.
- In Chrome, open
chrome://extensions. - Enable "Developer mode" (top-right).
- Click "Load unpacked" and select the project folder.
- You should now see the extension in your toolbar.
Note: Without the backend running, the extension won’t be able to generate summaries (it needs an API). See the backend setup below.
The extension expects a local API at http://localhost:5000/api. You can change this in background/background.js by editing API_BASE_URL.
python -m venv .venv
. .venv/Scripts/activate # Windows PowerShell
# source .venv/bin/activate # macOS/Linuxpip install -r api/requirements.txtCreate a .env file in the project root (or set these variables in your shell). Minimum required:
OPENAI_API_KEY=sk-...your-key...
# Optional overrides
OPENAI_MODEL=gpt-4o-mini
# Optional MySQL settings for caching
DB_HOST=127.0.0.1
DB_USER=root
DB_PASSWORD=
DB_NAME=verbaiIf you want to cache summaries, create a database (default name verbai) and table videodata similar to:
CREATE TABLE IF NOT EXISTS videodata (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
video_id VARCHAR(64) NOT NULL,
video_title VARCHAR(512) DEFAULT '' NOT NULL,
description LONGTEXT NULL,
transcript LONGTEXT NULL,
transcript_json LONGTEXT NULL,
ai_summary LONGTEXT NULL,
ai_summaries_json LONGTEXT NULL,
channel_info LONGTEXT NULL,
status TINYINT DEFAULT 1 NOT NULL,
called INT DEFAULT 1 NOT NULL,
created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uq_video_id (video_id)
);If you don’t want caching, you can still run the backend without the database being available; DB operations are best-effort and will be skipped on failure.
python api/app.pyThis starts Flask at http://localhost:5000. The extension will call POST http://localhost:5000/api/summerize to generate summaries.
- Open a YouTube video that has captions enabled.
- Click the extension icon. The side panel and/or popup will appear.
- Click “Summarize” to generate a new summary.
- If the video has been summarized before and DB caching is enabled, the extension may show a cached result quickly.
- Copy, read key points, and navigate timestamps as available.
Tips:
- If you see “Please open a YouTube video page”, refresh the tab and try again.
- Some videos don’t have transcripts; the extension will let you know if none can be found after retries.
- Backend base URL: edit
background/background.js:
const API_BASE_URL = "http://localhost:5000/api";- OpenAI model: set
OPENAI_MODELin.env. Default:gpt-4o-mini. - Database: set
DB_*variables in.env. If not set or not reachable, the API still works without caching.
- No summary and an error about API key: ensure
OPENAI_API_KEYis set and the backend is running. - CORS errors in console: Flask adds permissive CORS headers; ensure you’re hitting
http://localhost:5000as configured. - “No transcript available”: The video likely lacks captions. Try another video with captions.
- Nothing happens on click: Refresh the YouTube tab to ensure the content script is injected.
- Cache not working: Check your MySQL connection details and that the
videodatatable exists.
- Transcript text and metadata are sent to your local backend for summarization.
- If DB is configured, summaries are stored locally for faster subsequent loads.
MIT (or your preferred license). Update this section as needed.