Skip to content

Chrome MV3 extension + FastAPI server to summarize any page and YouTube transcripts. Local-first, Gemini-ready.

License

Notifications You must be signed in to change notification settings

sushant097/tabgist-chrome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TabGist

Summarize Any Tab (Web + YouTube) with a Chrome Extension

Chrome MV3 FastAPI Python Gemini Ready YouTube License: MIT PRs Welcome

A fast Chrome extension + tiny FastAPI server that:

  • Summarizes any web page.
  • Auto-detects YouTube videos, fetches transcripts, and gives clean chapter-style notes.
  • Translates summaries to EN/DE/KN/ES (and more).
  • Works locally. Uses Gemini if you add an API key. Falls back to a lightweight local summarizer if not.

🎥 DEMO:

TabGist Walkthrough
Watch on YouTube

🧩 Extension Zip: Download from here.


Table of Contents


Features

  • ✅ One-click Summarize for any tab
  • YouTube-aware: pulls transcript and produces chapter-style bullets
  • Separate prompts for YouTube vs Websites for better results
  • Translate into common languages
  • Open in Tab viewer with clean typography and print/PDF
  • ✅ Everything talks to http://localhost:8080

Architecture

[Chrome Extension (MV3)]
   ├─ popup.html/js  → calls local FastAPI
   ├─ content.js     → extracts visible page text or YouTube videoId
   └─ background.js  → context menu, defaults

[FastAPI Server]
   ├─ /summarize     → uses Gemini (if key) or local fallback
   ├─ /translate     → optional translation via Gemini
   └─ YouTube        → robust transcript fetcher (manual → auto)

Quick Start

1) Clone and set up the server

git clone https://github.com/sushant097/tabgist-chrome
cd tabgist-chrome
python -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows PowerShell
# .\.venv\Scripts\Activate.ps1

pip install -U pip
pip install -r requirements.txt

2) Create .env (see next section) and run

uvicorn app:app --reload --host 127.0.0.1 --port 8080

Check:

  • http://127.0.0.1:8080/ → returns { ok, use_gemini, version }
  • http://127.0.0.1:8080/health (if you add one) → {"ok": true}

Create .env (Gemini)

Create a file named .env in server/:

GEMINI_API_KEY=your_google_generative_ai_key_here
  • If set, the server uses Gemini 1.5 Flash for better summaries and real translation.
  • If not set, the server still works with a small local summarizer. Translation will show a helpful placeholder.

Install the Extension

Find the extension in: /extension/tabgist_chrome_extension.zip

  1. Unzip it anywhere.
  2. Open Chrome → go to chrome://extensions
  3. Toggle Developer mode (top right)
  4. Click Load unpacked → select the unzipped extension folder
  5. Pin the extension icon
  6. In the popup, set Server to http://localhost:8080 if it isn’t already

Permissions used

  • activeTab, scripting, tabs (to read the current page via content script)
  • storage (to remember server URL)
  • contextMenus (optional quick action)

Tip: To summarize local files, open the extension Details and enable “Allow access to file URLs.”


Use It

  1. Start the server (uvicorn … above).

  2. Open any article page → click Summarize.

  3. Open a YouTube video (watch, shorts, or youtu.be) → Summarize:

    • The extension sends videoId.
    • The server fetches transcript and applies a YouTube-specific prompt.
  4. Choose a Target language and click Translate.

  5. Use Open in Tab for a large, printable view.

The popup renders Markdown-ish bullets as clean HTML. Your full-page viewer supports Copy and Print/PDF.


API (for hackers)

POST /summarize

Body

{
  "tab": {
    "url": "https://example.com",
    "title": "Page Title",
    "isYouTube": false,
    "videoId": null,
    "text": "Visible page text…"
  },
  "options": {
    "target_lang": "en",
    "style": "bullet"
  }
}

Response

{ "pretty": "• Bullet one\n• Bullet two\n\n**TL;DR** ..." }
  • If isYouTube is true and videoId exists, the server uses the YouTube transcript and a YouTube-specific prompt.
  • style can be bullet, tldr, or notes (server maps this inside the prompt).

POST /translate

Same body. Translates tab.text or YouTube transcript. If Gemini is unavailable, returns a friendly placeholder and a snippet.


🧰 Troubleshooting

Popup says “Could not establish connection. Receiving end does not exist.”

  • The content script is not injected. We inject it on demand, but you must be on a normal page (starts with http(s):// or file://).
  • Restricted pages (Chrome Web Store, chrome://*, PDFs) cannot be injected.

Service worker registration failed

  • Reload the extension in chrome://extensions.
  • Ensure background.js is present and there are no syntax errors.
  • Check permissions include contextMenus and tabs.

YouTube: “No text found to summarize. (YouTube transcript: …)”

  • Some videos disable transcripts or don’t have them yet.
  • We try manual English first, then auto. You’ll see a clear reason like TranscriptsDisabled or NoTranscriptFound.

“Gemini unavailable”

  • Create .env with GEMINI_API_KEY=...
  • Restart the server. Home endpoint should show "use_gemini": true.

Port already in use

uvicorn app:app --reload --host 127.0.0.1 --port 9090

Update the Server field in the popup to match.

File URLs

  • In extension Details, enable Allow access to file URLs.

Privacy

  • The extension talks only to your machine at http://localhost.
  • Page text and transcripts are processed locally and, if you enable Gemini, sent to Google’s API for generation.
  • Your API key lives in .env. Do not commit it.

Roadmap

  • Side panel UI for persistent notes
  • Timestamped chapters (00:00 Intro, 02:15 Topic A) using transcript start times
  • Export to Markdown, Notion, or Google Docs
  • Deploy server into cloud.
  • Custom prompt editor in Options
  • More languages and styles

License

MIT. See LICENSE.


Credits

Built with ❤️ using Chrome MV3, FastAPI, and optional Gemini.

Questions or ideas? Open an issue or a PR.

About

Chrome MV3 extension + FastAPI server to summarize any page and YouTube transcripts. Local-first, Gemini-ready.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published