Gan, Jimmy 5e91a1f056 Inject custom requests.Session with browser User-Agent into YouTubeTranscriptApi
- Add requests import to summarizer.py
- Configure requests.Session with macOS Chrome User-Agent and English Accept-Language headers
- Initialize YouTubeTranscriptApi with custom http_client to bypass YouTube anti-scraping blocks on residential IPs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 11:13:17 +08:00

T YouTube - Text-Based YouTube Digest

A text-based reader for YouTube. It syncs with your logged-in YouTube subscription feed, fetches video transcripts, generates concise summaries via Claude 3.5 Haiku, and displays them in a Svelte 5 + FastAPI web dashboard.


🚀 Setup Instructions

1. Extract your YouTube browser cookies

Since YouTube restricts subscription feeds to logged-in users, you need to export your logged-in cookies so yt-dlp can request the feed on your behalf:

  1. Install a browser extension like Get cookies.txt LOCALLY (Chrome/Edge) or cookies.txt (Firefox).
  2. Open YouTube in your browser and ensure you are logged in to your account.
  3. Click the extension icon and export the cookies for youtube.com as a Netscape-formatted text file.
  4. Create a folder named config in your project root, rename the exported file to cookies.txt, and save it inside:
    t-youtube/config/cookies.txt
    

2. Configure Environment Variables

Create a .env file in the root directory:

# Optional: Override the fallback OpenAI / Anthropic key
OPENAI_API_KEY=sk-Kq5JbgmnEEkdzTqNAQ6bV6nztQ0ngeHTHF9Vg8nUglQvrOlx

3. Build & Deploy using Docker Compose

Run the following command to build the multi-stage image (compiles frontend static assets using Node, then packages backend with Python) and start the container:

docker compose up -d --build

The server will boot up and listen on port 8000.


📁 Repository Structure

t-youtube/
├── backend/
│   ├── main.py                  # FastAPI server & endpoints
│   ├── db.py                    # aiosqlite database schema initialization
│   ├── fetcher.py               # Subscription scraper using yt-dlp
│   ├── summarizer.py            # Transcript retriever & Claude API client
│   └── requirements.txt         # Python dependencies
├── frontend/
│   ├── src/
│   │   ├── routes/
│   │   │   └── YoutubeDashboard.svelte # Svelte 5 runes UI
│   │   ├── App.svelte           # Svelte App entry point
│   │   └── main.js
│   ├── package.json             # NPM package definitions
│   └── vite.config.js           # Vite dev server proxy rules
├── Dockerfile                   # Multi-stage production build script
└── docker-compose.yml           # Synology NAS deployment config

📋 Features & Usage

  1. Sync Subscriptions: Click the Sync Subscriptions button at the top of the dashboard. This triggers a background process that fetches your subscription feed, compares it with the database, adds new entries, extracts transcripts, and generates Claude digests automatically.
  2. Fast Reading Layout: Click on any video card in the sidebar. You will instantly see the channel name, publish date, video length, and the AI-generated digest containing:
    • Core Hook (Bolded)
    • Key Takeaways (Bullet list)
    • Actionable Verdict
  3. Read/Skip State: Mark videos as Read or Skip to clear them from your pending queue, allowing you to only keep track of what's unread.
  4. View Full Transcript: Expand the accordion at the bottom of the digest to read the raw transcripts if needed.
S
Description
T YouTube - Text-Based YouTube Digest
Readme 245 KiB
Languages
Python 60%
Svelte 34.6%
Shell 3.4%
Dockerfile 0.7%
JavaScript 0.5%
Other 0.8%