Skip to main content

narrately

Convert a web article, or any text, into a spoken mp3 file.

Installation

pip install narrately

Usage

From a web article URL

from narrately import article_to_audio

output_path = article_to_audio(
    "https://example.com/some-article",
    "article",
    lang="en",
)
print(f"Saved audio to {output_path}")

article_to_audio(url, audio_file_name, lang="en") downloads and extracts the article text from url (using newspaper3k), converts it to speech (using gtts), and saves it as {audio_file_name}.mp3. It returns the Path to the generated file.

From plain text

from narrately import text_to_audio

output_path = text_to_audio(
    "Hello, this text will become an mp3 file.",
    "greeting",
    lang="en",
)
print(f"Saved audio to {output_path}")

text_to_audio(text, audio_file_name, lang="en") skips the scraping step and converts text directly to speech, saving it as {audio_file_name}.mp3. It returns the Path to the generated file.

Shared arguments

audio_file_name can be a plain name (saved in the current directory) or a full path, e.g. "output/my_article" — either way, don't include the .mp3 extension, it's appended automatically.

lang is a two-letter language code (e.g. "en", "es", "fr") passed through to gtts.

Notes

  • Requires an internet connection: both article scraping and speech generation call external services.
  • Some sites block automated scraping or require a paid subscription (paywalls); in those cases article extraction may fail or return partial content.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

narrately-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

narrately-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file narrately-0.1.0.tar.gz.

File metadata

  • Download URL: narrately-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for narrately-0.1.0.tar.gz
Algorithm Hash digest
SHA256 99c80bc145abb7d5b0eb9e7fde834d085278feef05e3a410fce85cc7eaeab6e7
MD5 6f785050d1a811d1453fe7ac090dc54d
BLAKE2b-256 34e8de3d516176dfde4c6dfcb028a73cb1eb2eadd5fba995cadb6dcd6a7dcadc

See more details on using hashes here.

File details

Details for the file narrately-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: narrately-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for narrately-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2c1eb6206b53b1c8ae72344089d36b23932dec923be17b2108019389f9e0c93
MD5 757d1695af90f1057577f45123eb9271
BLAKE2b-256 4d287cce2c34adebf8ea9119e6995d37edac5c9ae7b5073bc67213e95cabb9a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page