A Python client library for downloading audiobooks from Libro.fm
Project description
librofm
A Python client library for downloading audiobooks from Libro.fm.
Features
- Download audiobooks from your Libro.fm library
- Support for both MP3 and M4B formats (M4B preferred when available)
- Automatic file organization by author and title
- Command-line interface for batch downloads
- Python API for programmatic access
Installation
pip install librofm
Configuration
Set your Libro.fm credentials as environment variables:
export LIBROFM_USERNAME="your_username"
export LIBROFM_PASSWORD="your_password"
Alternatively, create a .env file in your working directory:
LIBROFM_USERNAME=your_username
LIBROFM_PASSWORD=your_password
Usage
Command Line
Download all audiobooks to the default directory (~/Audiobooks):
librofm-download
Download to a custom directory:
librofm-download /path/to/audiobooks
Show help:
librofm-download --help
Python API
from librofm.client import LibroFMClient
# Create client (uses environment variables)
client = LibroFMClient.get_client()
# Or create with explicit credentials
client = LibroFMClient("username", "password")
# Get your library
page = client.get_library()
print(f"Found {len(page.audiobooks)} audiobooks")
# Download a specific audiobook
audiobook = page.audiobooks[0]
success = client.download(audiobook, "/path/to/downloads")
# Get download manifest for MP3 files
manifest = client.get_download_manifest(audiobook)
print(f"Audiobook has {len(manifest.parts)} parts")
# Get M4B package info
m4b_info = client.get_packaged_m4b_info(audiobook)
if m4b_info:
print(f"M4B available at: {m4b_info.m4b_url}")
File Organization
Downloaded audiobooks are organized as:
base_path/
\x00\x00 Author Name/
\x00\x00 Book Title/
\x00\x00 part1.mp3
\x00\x00 part2.mp3
\x00\x00 ...
\x00\x00 Another Author/
\x00\x00 Another Book/
\x00\x00 book.m4b
Requirements
- Python 3.10+
- Active Libro.fm account with audiobooks in your library
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Disclaimer
This tool is for personal use only. Please respect Libro.fm's terms of service and only download audiobooks you have legally purchased.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file librofm-0.1.0.tar.gz.
File metadata
- Download URL: librofm-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.6 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70552ecf061c6000a7b3cd232f4ea7595618de143423e1f302a428b6cf5b25a2
|
|
| MD5 |
7749fe9752df7371ab96d2ebd842298b
|
|
| BLAKE2b-256 |
e0649253eca8e5ef91a9d04da7703cb5a525ab8cc4dbfdc91d28dc47a649e4b7
|
File details
Details for the file librofm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: librofm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.10.6 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd0857fb08bb0743c6e0b2eb24ed8816da43ee3fe685ea5bf36437d2da11dfc
|
|
| MD5 |
18bb851de5c55de36e21ada9fe2a641c
|
|
| BLAKE2b-256 |
214720c1da3b140f78be33a44941fc29d6b7c880844bb5e204c90fbe575ff49e
|