Skip to main content

EpubEdit

EpubEdit is a Python package for viewing and editing EPUB file metadata.

Installation and Usage

  • Installation:
pip install epubedit
  • Usage:
from epubedit import Epubedit # import the library

book = Epubedit('book_name') # create Epubedit object 
book.get_metadata() 

Methods

  1. get_metadata -> str | List[str]
  2. get_selected_metadata -> Dict[str, str]
  3. get_all_metadata -> Dict[str, str]

1. get_metadata(str) -> str | List

Read the value of a single metadata

Supported parameters:

  • "epub_version"
  • "book_name"
  • "author_name"
  • "publisher_name"
  • "ISBN"
  • "ASIN"
  • "bookid"
  • "describe"
  • "language"
  • "rights"
  • "publication_date"

Example:

from epubedit import Epubedit

book = Epubedit("Moby Dick.epub")
print(book.get_metadata('book_name'))

Running results

Moby Dick; Or, The Whale

2. get_selected_metadata(Iterable[str]) -> Dict[str: str]

Pass a list and transmit the corresponding metadata values

from epubedit import Epubedit

book = Epubedit("Moby Dick.epub")
print(book.get_selected_metadata(["book_name", "epub_version", "language"]))

Running results

{"book_name": "Moby Dick; Or, The Whale", "epub_version": "3.0", "language": "en"}

3. get_all_metadata() -> Dict[str: str]

No input value, all metadata information is transmitted. If there is a lack of relevant information in EPUB, it will return str: "" or list: []

book = Epubedit('Moby Dick.epub')
print(book.get_all_metadata())

Running results

{
    "epub_version": "3.0",
    "rights": "Public domain in the USA.",
    "book_name": "Moby Dick; Or, The Whale",
    "author": ["Herman Melville"],
    "isbn": "",
    "asin": "",
    "publisher": "",
    "published_date": "",
    "modified_date": "2024-07-20T22:24:39Z",
    "language": "en",
    "subject": [
        "Whaling -- Fiction",
        "Sea stories",
        "Psychological fiction",
        "Ship captains -- Fiction",
        "Adventure stories",
        "Mentally ill -- Fiction",
        "Ahab, Captain (Fictitious character) -- Fiction",
        "Whales -- Fiction",
        "Whaling ships -- Fiction"
    ]
}

4. change_metadata(Dict[str: str]) -> None

book = Epubedit("your.epub")

book.change_metadata("epub_version", "3.0")
book.change_metadata("book_name", "new_name")
book.change_metadata("author_name", "new_author")
book.change_metadata("publisher_name", "new_publisher")

book.commit()

Metadata

Release files for epubedit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epubedit 0.1.1
File Size Uploaded
epubedit-0.1.1.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for epubedit 0.1.1
File Interpreter ABI Platform
epubedit-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / epubedit-0.1.1.tar.gz

Download URL epubedit-0.1.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7cde5df09f6095f53252d3fd060f2bb95b43ad9cffe35118789dc5272a49093f
BLAKE2b-256 checksum
How to use checksums
8128664f1849fd6d7134bdc80b35d9d1f15b776f3d29fdcc97bd57740963a4a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / epubedit-0.1.1-py3-none-any.whl

Download URL epubedit-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a37add6c9351ea2a1c06f84390540baf15f75025cfdb08435b0502e6a51a117f
BLAKE2b-256 checksum
How to use checksums
e7d8b34312d30d71b6106b7774a6b9e863b8bea8d3bf768a6672716bd93e3285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page