A lightweight desktop app that grabs the YouTube video URL from your clipboard, pulls its subtitles, and uses GPT-3.5 Turbo to summarize the video into key points, all from a small always-available customtkinter window with a global hotkey.
- One-hotkey summarization: press
Alt+Sanywhere on your system to summarize the YouTube video URL currently in your clipboard. - Automatic language fallback: tries English first, then a manually-provided transcript, then auto-generated captions, then falls back through 10 other languages if English isn't available.
- Follow-up enquiries: ask custom questions about the video (or about anything, even without subtitles) and chain follow-up questions off previous answers.
- View & copy raw subtitles: inspect the original transcript text and copy it to your clipboard.
- Dark-themed GUI built with
customtkinter.
- You copy a YouTube link (e.g.
https://www.youtube.com/watch?v=...) to your clipboard. - You either click Get Subtitles in the app window, or press the global hotkey
Alt+S(works even if the app is in the background, it brings itself to the front automatically). - The app extracts the video ID from the URL and requests its transcript via
youtube-transcript-api. - If subtitles are found, the full transcript text is truncated (to stay within token limits) and sent to OpenAI's
gpt-3.5-turbomodel with a summarization prompt. - The summary is displayed in the main text box. The full original transcript is kept in memory so you can view it later or use it as context for follow-up questions.
- From the Enquiry window you can ask GPT a custom question. If a transcript is loaded, it's included as context; otherwise the question is answered standalone. Each answer has its own Enquiry button so you can keep drilling deeper, using the previous answer as the new reference text.
flowchart TD
A[Clipboard: YouTube URL] -->|Alt+S or Get Subtitles button| B[fetch_subtitles]
B --> C{Extract video_id}
C --> D[get_subtitles via youtube_transcript_api]
D -->|Manual transcript found?| E{Yes/No}
E -->|No| F[Try auto-generated a.lang transcript]
E -->|Yes| G[Format transcript to plain text]
F --> G
G --> H[truncate_text: cap token/word count]
H --> I[summarize_text via OpenAI gpt-3.5-turbo]
I --> J[Display summary in main text_box]
G --> K[Store as original_subtitles - global state]
L[Enquiry button] --> M[open_enquiry_window]
M --> N{original_subtitles loaded?}
N -->|Yes| O[perform_enquiry: subtitles + prompt + reference_text]
N -->|No| P[ask_without_subtitles: prompt + reference_text]
O --> Q[OpenAI chat.completions.create]
P --> Q
Q --> R[show_enquiry_response window]
R -->|Click Enquiry again| M
S[Show Subtitles button] --> T[show_original_subtitles window]
T --> U[Copy to clipboard via pyperclip]
| Layer | Responsibility | Key functions |
|---|---|---|
| Input capture | Reads the YouTube URL from the OS clipboard, listens for the global hotkey | pyperclip.paste(), keyboard.add_hotkey('alt+s', ...) |
| Transcript retrieval | Fetches manual or auto-generated captions in the requested language, with multi-language fallback | get_subtitles(), YouTubeTranscriptApi |
| Text preprocessing | Caps the transcript length so it fits within the model's context window | truncate_text() |
| LLM summarization | Sends the transcript to OpenAI and returns a structured summary | summarize_text(), OpenAI client |
| Interactive Q&A | Lets the user ask follow-up questions, with or without transcript context, chaining prior answers as new context | open_enquiry_window(), perform_enquiry(), ask_without_subtitles(), show_enquiry_response() |
| GUI layer | Dark-themed window, buttons, popups for subtitles/responses | customtkinter (CTk, CTkToplevel, CTkTextbox, CTkButton) |
| App state | In-memory globals tracking the current transcript and last answer (no persistence/database) | original_subtitles, last_enquiry_response |
The app is a single-process, single-file Python script with no backend server. All "architecture" lives inside one event loop (root.mainloop()), with the OpenAI API as the only external LLM dependency and the clipboard as the only "input channel" for video selection.
- Python 3.9+
- An OpenAI API key with access to
gpt-3.5-turbo
pip install customtkinter youtube-transcript-api pyperclip openai keyboardNote: On Linux, the
keyboardlibrary typically requires root privileges to capture global hotkeys (run withsudo). On macOS, you may need to grant Accessibility/Input Monitoring permissions to your terminal/IDE.
- Clone or download
Summarizer.py. - Open the file and replace the placeholder API key:
with your real OpenAI API key. For better security, use an environment variable instead:
api_key = 'your_openai_api_key'
import os api_key = os.environ.get("OPENAI_API_KEY")
- Install the dependencies listed above.
- Run the app:
python Summarizer.py
- Copy any YouTube watch URL to your clipboard.
- Press Alt+S, or click Get Subtitles in the app window.
- Read the generated summary in the main panel.
- Click Show Subtitles to view (and copy) the full original transcript.
- Click Enquiry to ask a custom question, about the video or anything else, and keep the conversation going by clicking Enquiry again from the response window.
- Only works with publicly available YouTube subtitles (manual or auto-generated); videos with subtitles disabled won't summarize.
- Long transcripts are truncated by word count rather than true token count, so very long videos may be cut short before summarization.
- The OpenAI API key is currently hardcoded as a placeholder in the script. Move it to an environment variable before sharing or committing this code anywhere public.
- Global hotkey support depends on OS-level permissions and may not work identically across Windows/macOS/Linux.