TLDW (Too Long; Didn't Watch)

A Python package that instantly summarizes YouTube videos using AI. Get the key points from any video without watching it!
✨ Features
- 🎥 YouTube Video Summarization: Extract transcripts and generate concise summaries
- 🤖 OpenAI GPT Integration: Powered by GPT-4o-mini for high-quality summaries
- 🎨 Beautiful CLI Output: Colorized terminal output with ASCII art
- 🔄 Streaming Response: Real-time summary generation
- 🐍 Simple Python API: Easy to integrate into your projects
🚀 Quick Start
Prerequisites
Installation
Install from PyPI:
pip install tldw
From source:
git clone git@github.com:DavidZirinsky/tl-dw.git
cd tl-dw/
python3 -m pip install .
Usage
from tldw import tldw
import os
summary = tldw(os.environ.get('OPENAI_API_KEY'))
summary.summarize('https://www.youtube.com/watch?v=LCEmiRjPEtQ')
📝 Example Output
________ ____ _ __
/_ __/ / / __ \ | / /
/ / / / / / / / | /| / /
/ / / /___/ /_/ /| |/ |/ /
/_/ /_____/_____/ |__/|__/
Summarizing video: https://www.youtube.com/watch?v=LCEmiRjPEtQ
--- Summary ---
In his talk, Andre Carpathy, former director of AI at Tesla, discusses the evolving
nature of software in the era of AI, particularly emphasizing the transition from
traditional coding (Software 1.0) to an AI-driven paradigm (Software 2.0 and 3.0).
He categorizes Software 1.0 as conventional code that directly instructs computers,
while Software 2.0 encompasses neural networks where the focus is on tuning data
sets instead of writing explicit code. He introduces Software 3.0, which involves
large language models (LLMs) that can be prompted in natural language, making
programming more accessible to non-coders.
[...continued summary...]
--- End of Summary ---
❓ Troubleshooting
Common Issues
"OpenAI API key is required" Error
- Make sure your OpenAI API key is set in the environment variable
OPENAI_API_KEY
- Verify your API key is valid and has sufficient credits
"Invalid YouTube URL provided" Error
- Ensure the URL is a valid YouTube video URL
- Supported formats:
https://www.youtube.com/watch?v=VIDEO_ID
or https://youtu.be/VIDEO_ID
"Failed to get transcript" Error
- The video may not have English captions/transcripts available
- Some videos may have restricted access to transcripts
- Try with a different video that has confirmed English captions
API Rate Limiting
- If you encounter rate limiting, wait a few moments before trying again
- Consider upgrading your OpenAI API plan for higher rate limits
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
)
- Commit your changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
🛠️ Development Setup
-
Install Dependencies:
pip install -e .
-
Then Run This With:
python3 src/tldw/tldw.py
🧪 Running Tests
To run the tests:
Locally:
pytest
You can also run tests in the Docker container, mimicking a PyPI wheel distribution installation.
docker compose down && docker compose up -d --build && docker logs tests -f
🤝 Pre-commit Hooks
This project uses pre-commit hooks to ensure code quality and consistency before commits.
-
Install pre-commit:
If you don't have pre-commit
installed globally, you can install it into your virtual environment:
pip install pre-commit
-
Install the Git hooks:
Navigate to the root of the repository and run:
pre-commit install
This command sets up the hooks in your .git/
directory.
-
Run hooks manually (optional):
To run all configured hooks against all files, without making a commit:
pre-commit run --all-files
Now, every time you try to commit, the pre-commit hooks will automatically run. If any hook fails, the commit will be aborted, allowing you to fix the issues before committing.
📦 Packaging for PyPI and Test PyPi
For PyPI:
Build and Upload:
pip install build twine
python3 -m build
python3 -m twine upload dist/*
For Test PyPi:
Build and Upload:
pip install build twine
python3 -m build
python3 -m twine upload --repository testpypi dist/*
Test PyPi Installation:
pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
tldw==1.0.3