Skip to main content

CLI tool for converting articles to podcasts

Project description

Article to Podcast

PyPI Changelog Tests License

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

  • Add elevenlabs.io support
    • We can utilize at first 10k chars once a month I think
  • Minimize costs on tests
  • Send to device right away
  • Handle redirects
  • Replace print with logger
  • Remove redundant warnings in pytest
  • Make sure pytest shows quota errors

Manual configurations

  • OPENAI_API_KEY secret was added to repository secrets
  • PYPI_TOKEN was added to release environment secrets

Inspired by

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

article_to_podcast-0.1.13.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

article_to_podcast-0.1.13-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file article_to_podcast-0.1.13.tar.gz.

File metadata

  • Download URL: article_to_podcast-0.1.13.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for article_to_podcast-0.1.13.tar.gz
Algorithm Hash digest
SHA256 929ad72dee60b0884b6e0869cc93b09bddec7c1533c9762fff513b08fa48f900
MD5 23e77155edaf70ad268586295726a967
BLAKE2b-256 3e9c096cc35e5d5f916e16f9e62c32e634daf525082c5359792586a4f3f5d0f9

See more details on using hashes here.

File details

Details for the file article_to_podcast-0.1.13-py3-none-any.whl.

File metadata

File hashes

Hashes for article_to_podcast-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 868acca2595ef06c5cb5b0081515123bb4b429cbe9458bcc748d11d77243b476
MD5 b04a199723ebedcb4401f4d977ed1bec
BLAKE2b-256 17a6e6d50b9266a19f4e1cfdecd2d8e5ffff5cd0bb5db26d29a59ea25e319a6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page