CLI tool for converting articles to podcasts
Project description
Article to Podcast
CLI tool for converting articles to podcasts using OpenAI's Text-to-Speech API.
Requirements
You need to have ffmpeg installed before running this CLI tool.
brew install ffmpeg
Since JS based articles can't be rendered with requests we're using playwright and chromium web driver to tackle that:
pip install playwright
playwright install chromium
Usage
Install article-to-podcast with:
pipx install article-to-podcast
article-to-podcast --help
Usage: article-to-podcast [OPTIONS]
Options:
--url TEXT URL of the article to be fetched.
[required]
--directory DIRECTORY Directory where the output audio file will
be saved. The filename will be derived from
the article title. [required]
--audio-format [mp3|opus|aac|flac|pcm]
The audio format for the output file.
Default is mp3.
--model [tts-1|tts-1-hd] The model to be used for text-to-speech
conversion.
--voice [alloy|echo|fable|onyx|nova|shimmer]
The voice to be used for the text-to-speech
conversion. Voice options: alloy: A
balanced and neutral voice. echo: A more
dynamic and engaging voice. fable: A
narrative and storytelling voice. onyx: A
deep and resonant voice. nova: A bright
and energetic voice. shimmer: A soft and
soothing voice. Experiment with different
voices to find one that matches your desired
tone and audience. The current voices are
optimized for English.
--help Show this message and exit.
export OPENAI_API_KEY="your-api-key"
article-to-podcast \
--url 'https://blog.kubetools.io/kopylot-an-ai-powered-kubernetes-assistant-for-devops-developers'
Development
If you're using Nix you can start running the tool by entering:
nix develop
export OPENAI_API_KEY="your-api-key"
python \
-m article_to_podcast \
--model tts-1-hd \
--voice nova \
--directory . \
--url 'https://blog.kubetools.io/kopylot-an-ai-powered-kubernetes-assistant-for-devops-developers'
Testing
If you used nix develop
all necessary dependencies should have already
been installed, so you can just run:
pytest
TODO
- Automatically fetch filename to save article from the article name
- Work around: "Enable JavaScript and cookies to continue" errors
- Add couple of seconds silences at the start or the end of the file
- Add dependency to publish workflow to wait for test
- Replace print with logger
- Remove redundant warnings in pytest
- Make sure pytest shows quota errors
Inspired by
- Long frustration of unread articles
- https://github.com/simonw/ospeak
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for article_to_podcast-0.1.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 187e05fc73061555a163e7b6618efdf0c728ff6497f3bce2b68bc20a26b5849d |
|
MD5 | 2d28dd6ea5be0c762a16c1225821e673 |
|
BLAKE2b-256 | eb674d9172ce5644d1a194b587fb2235819472bdeb67a1a8f816dc940bb63759 |
Close
Hashes for article_to_podcast-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb55ca0e5ea35c4dfd881a55818d1f4c1bddcc1987b0cf15e9efa7461e5187a7 |
|
MD5 | a921e85ce131bf0ff69c63e4d56ecdeb |
|
BLAKE2b-256 | 2495c972b2af0efc94dd73c75d1ee91dbb4ebb35206ebb54c820c0de6331bb1c |