A lightweight CLI tool that converts web page content to audio using Kokoro TTS. Simply provide a URL, and the tool fetches the content, extracts readable text, and generates an MP3 audio file.
- Fetches and extracts readable content from web pages
- Handles large articles by intelligently chunking text (~1500 characters per chunk)
- Uses Kokoro TTS API with
af_heartvoice - Combines multiple audio chunks into a single MP3 file
- Generates timestamped filenames for easy organization
- Comprehensive unit tests for all components
- Go 1.21 or higher
- Kokoro TTS running locally at
http://localhost:8880 - ffmpeg (for combining audio chunks)
macOS:
brew install ffmpegUbuntu/Debian:
sudo apt-get install ffmpegWindows: Download from ffmpeg.org
# Clone the repository
git clone <repository-url>
cd content-reader
# Install dependencies
go mod download
# Build the application
go build -o content-reader./content-reader <url># Convert a blog post to audio
./content-reader "https://steipete.me/posts/just-talk-to-it"
# Convert a Wikipedia article
./content-reader "https://en.wikipedia.org/wiki/Go_(programming_language)"
# Convert another blog post
./content-reader "https://simonwillison.net/2026/Feb/7/claude-fast-mode/#atom-everything"The tool will:
- Fetch the webpage content
- Extract readable text (removing navigation, ads, etc.)
- Split text into manageable chunks
- Generate speech for each chunk using Kokoro TTS
- Combine all chunks into a single MP3 file
- Save the output with a filename based on the URL and timestamp
The project is organized into focused packages:
- fetcher - Handles HTTP requests with proper headers
- extractor - Extracts readable content from HTML using go-readability
- chunker - Splits large text into optimal-sized chunks for TTS processing
- tts - Communicates with Kokoro TTS API
- main - CLI interface that orchestrates the workflow
Run all unit tests:
# Run all tests
go test ./... -v
# Run tests for a specific package
go test ./fetcher -v
go test ./extractor -v
go test ./chunker -v
go test ./tts -v
# Run tests with coverage
go test ./... -coverAll tests are passing with comprehensive coverage of core functionality.
The tool uses the following defaults:
- Kokoro TTS URL:
http://localhost:8880 - Voice:
af_heart - Chunk Size: 1500 characters
- Output Format: MP3
These can be modified in the source code if needed.
- Some heading titles may be missing in the generated audio
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.