-2

I need to get metadata info from a eBook such as author, publication date, publisher, plot, etc. The formats are '.mobi', '.azw', '.azw2', '.azw3', '.epub'.

Is there any cocoa class for that? If not, which libraries do you suggest me?

aneuryzm
  • 63,052
  • 100
  • 273
  • 488
  • 'eBook' is a broad term that doesn't specify what kind of document you need to inspect. If you mean PDF, the Quartz functions for `CGPDFDocument` give you access to the metadata. – Fruity Geek Mar 21 '14 at 13:09
  • @FruityGeek I need for '.mobi', '.azw', '.azw2', '.azw3', '.epub' – aneuryzm Mar 21 '14 at 13:14

1 Answers1

0

I think no, but all those formats have xml based metadata formats, so use any xml parser you like.

Just unzip file and see what inside. For example internals of some .epub

enter image description here

sage444
  • 5,661
  • 4
  • 33
  • 60
  • I see, thanks this is useful. And how do I extract the xml file to parse? – aneuryzm Mar 21 '14 at 13:30
  • Sorry one more thing: I'm trying to iterate through the content of the .epub file using NSBundle * eBookBundle = [NSBundle bundleWithPath:path]; but it just doesn't work. I guess because it is not a bundle. How do I access to the files inside? – aneuryzm Mar 21 '14 at 14:24
  • you should use zip unarchiver first, search code on github, then NSFileManager to get files – sage444 Mar 21 '14 at 14:30
  • So I should use a 3rd party library to unzip it? There is no way to do with native code? – aneuryzm Mar 21 '14 at 14:33
  • probably yes, you need additional lib, for example see this question http://stackoverflow.com/q/11333399/1403732 – sage444 Mar 21 '14 at 15:28
  • Ok. So the epub format is actually a zipped file to unzip? – aneuryzm Mar 21 '14 at 16:02
  • yes, exactly, is what i want to say from begining) – sage444 Mar 21 '14 at 16:04
  • I'm back to ask you how to deal with MOBI files? They are not unzippable apparently. How can I extract the xml content? thanks – aneuryzm Mar 25 '14 at 14:21
  • sorry, I can't help with this format, try create another question – sage444 Mar 25 '14 at 14:23