def get_epub_info(fname):
    ns = {'n': 'urn:oasis:names:tc:opendocument:xmlns:container', 'pkg':
        'http://www.idpf.org/2007/opf', 'dc':
        'http://purl.org/dc/elements/1.1/'}
zip = zipfile.ZipFile(fname)
txt = zip.read('META-INF/container.xml')
tree = etree.fromstring(txt)
cfname = tree.xpath('n:rootfiles/n:rootfile/@full-path', namespaces=ns)[0]
cf = zip.read(cfname)
tree = etree.fromstring(cf)
p = tree.xpath('/pkg:package/pkg:metadata', namespaces=ns)[0]
res = {}
for s in ['title', 'language', 'creator', 'date', 'identifier']:
    res[s] = p.xpath('dc:%s/text()' % s, namespaces=ns)[0]
return res
Библиотека Python для извлечения информации «epub»