Skip to main content

Mobi Python Library

Project description

Mobi Python Library

This should be considered alpha quality software.

This library provides a little API for accessing the contents of an unencrypted .mobi file. Here's a short example:

from mobi import Mobi

book = Mobi("test/CharlesDarwin.mobi");
book.parse();
# this will print, 1 record at a time, the entire contents of the book
for record in book:
    print record

This library provides quite a lot of access to the metadata included in any mobibook. For example, Gutenburg's Origin of the Species:

>>> pprint(book.config)
{'exth': {'header length': 356,
          'identifier': 1163416648,
          'record Count': 15,
          'records': {100: 'Charles Darwin',
                      101: 'Project Gutenberg',
                      105: 'Natural selection',
                      106: '1999-12-01',
                      109: 'Public domain in the USA.',
                      112: 'http://www.gutenberg.org/files/2009/2009-h/2009-h.htm',
                      201: '\x00\x00\x00\x00',
                      202: '\x00\x00\x00\x01',
                      203: '\x00\x00\x00\x00',
                      204: '\x00\x00\x00\x01',
                      205: '\x00\x00\x00\x06',
                      206: '\x00\x00\x00\x02',
                      207: '\x00\x00\x00)',
                      300: '\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4\xed\xec\xbe@\x94'}},
 'mobi': {'DRM Count': 0,
          'DRM Flags': 0,
          'DRM Offset': 4294967295,
          'DRM Size': 0,
          'EXTH flags': 80,
          'First Image index': 334,
          'First Non-book index': 329,
          'Format version': 6,
          'Full Name': 'The Origin of Species by means of Natural Selection, 6th Edition',
          'Full Name Length': 64,
          'Full Name Offset': 604,
          'Generator version': 6,
          'Has DRM': False,
          'Has EXTH Header': True,
          'Input Language': 0,
          'Language': 9,
          'Mobi type': 2,
          'Output Language': 0,
          'Start Offset': 2808,
          'Unique-ID': 4046349163,
          'header length': 232,
          'identifier': 1297039945,
          'text Encoding': 1252},
 'palmdoc': {'Compression': 2,
             'Encryption Type': 0,
             'Unknown': 0,
             'Unused': 0,
             'record count': 327,
             'record size': 4096,
             'text length': 1336365}}
>>>

Retrieving Author and Title

The author and title of a book can be retrieved using the author() and title() methods respectively on a Mobi() object. The parse() method needs to have already been called.

Project details


Download files

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

Source Distribution

mobi-python-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

mobi_python-0.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file mobi-python-0.0.1.tar.gz.

File metadata

  • Download URL: mobi-python-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for mobi-python-0.0.1.tar.gz
Algorithm Hash digest
SHA256 010d0ed1933ee9bf33330ac125e55f9cb956078b6e62cbdba59b3bd753f903f3
MD5 e0d96c96fe25f6a7b96be0364ec0ecd0
BLAKE2b-256 9f71a27d71594bcccc95883eb03cc3de3c2be3dda9bf024020f9b4b1d61b7451

See more details on using hashes here.

File details

Details for the file mobi_python-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mobi_python-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for mobi_python-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 890a14485ee83f6973f72eb51b6117a6c6da73e52210ea4c41dad9093f1d01b8
MD5 c3b39745e47b3a55ed8fd5d872b7437a
BLAKE2b-256 426714d965ae770d69cbc3fd8148ba7e7c6598952bf333306a1e1b10a528f352

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page