In this particular case it has been used to convert that incredible literary work Spoon River Anthology by Edgar Lee Masters to keep this masterpiece alive and present on the internet.
- Parse a free EPUB using Python and eBookLib.
- Generate a structured JSON file with the text of the poems.
- Generate HTML pages for debugging and further processing with BeautifulSoup.
- Fully configurable via environment variables.
data/ # Stores the final JSON result
tools/ # Contains the main Python script
output/ # Contains each page in HTML, useful for debugging and constructing HTML with BeautifulSoup
res/ # Original input EPUB file
.env # Environment variables, e.g. TEXT_FILE pointing to the input file
- Clone the repository:
git clone https://github.com/yourusername/epub2JSON.git
cd spreadMasters- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # Linux / macOS
venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Configure your
.envfile:
TEXT_FILE=res/<filename>.epub
- Run the main script:
python tools/epub2json.py-
The resulting JSON will be saved in
data/. -
Optional: check HTML output in
output/for debugging or formatting.
Feel free to fork, open issues, or submit pull requests!
This project is currently tailored to Spoon River Anthology, but can be adapted for other EPUBs with minor adjustments.
- The EPUB source is public domain.
- Please do not upload proprietary EPUBs.