Skip to content

casinesque/epub2JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

epub2JSON

Simple piece of software able to transform epub to JSON.

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.

Features

  • 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.

Structure

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

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/epub2JSON.git
cd spreadMasters
  1. Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate   # Linux / macOS
venv\Scripts\activate      # Windows
  1. Install dependencies:
pip install -r requirements.txt

Usage

  1. Configure your .env file:
TEXT_FILE=res/<filename>.epub
  1. Run the main script:
python tools/epub2json.py
  1. The resulting JSON will be saved in data/.

  2. Optional: check HTML output in output/ for debugging or formatting.

Contributing

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.


License / Copyright

  • The EPUB source is public domain.
  • Please do not upload proprietary EPUBs.

About

Simple tool to convert epub to json data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages