Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Removing DRM protection from eBooks (http://stream-recorder.com/forum/forumdisplay.php?f=63)
-   -  

Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader

(http://stream-recorder.com/forum/showthread.php?t=8927)

drsquash 05-01-2011 10:36 AM

Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
hi there,

I just bought a book on Amazon, and I would like to read it also on my sony prs. Needless to say, I need to get rid of the DRM.

I use Calibre, so I installed the latest version of the drm tools, all went fine. I installed Kindle for PC on wine-1.3 (both the current updated version and an older one) and I downloaded on the hard drive the book I bought as a prc file (the first time, I downloaded the book on my android phone, with the kindle app, but I did not manage to find it in the filesystem). I thought I read that if you use Kindle for PC, you need nor a serial nor a PID. I just tried importing the book with calibre, but I get this error message

Code:

Error decoding: /home/blabla/My Kindle Content/mybook.prc
the book is in the collection however, so I tried to convert it in order to get some more verbose error message. When I try to convert to lrf I get:


Code:

calibre, version 0.7.58
ERROR: Conversion Error: <b>Failed</b>: Convert book 1 of 1 (BOOKNAME)

Convert book 1 of 1 (BOOKNAME)
Resolved conversion options
calibre version: 0.7.58
{'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0.0,
 'book_producer': None,
 'change_justification': 'original',
 'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\\s+', 'i')) or @class = 'chapter']",
 'chapter_mark': u'pagebreak',
 'comments': None,
 'cover': u'/tmp/calibre_0.7.58_tmp_Nn4kaW/calibre_0.7.58_7viLlp.jpeg',
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'enable_autorotation': False,
 'enable_heuristics': False,
 'extra_css': None,
 'fix_indents': True,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'header': False,
 'header_format': u'%t by %a',
 'header_separation': 0.0,
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x37bd810>,
 'insert_blank_line': False,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'language': None,
 'level1_toc': None,
 'level2_toc': None,
 'level3_toc': None,
 'line_height': 0.0,
 'linearize_tables': False,
 'margin_bottom': 5.0,
 'margin_left': 5.0,
 'margin_right': 5.0,
 'margin_top': 5.0,
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_indent': 0.0,
 'minimum_line_height': 120.0,
 'mono_family': u'None',
 'no_chapters_in_toc': False,
 'no_inline_navbars': False,
 'output_profile': <calibre.customize.profiles.SonyReaderOutput object at 0x37c30d0>,
 'page_breaks_before': u"//*[name()='h1' or name()='h2']",
 'prefer_metadata_cover': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/tmp/calibre_0.7.58_tmp_Nn4kaW/calibre_0.7.58_JU5sCu.opf',
 'remove_fake_margins': True,
 'remove_first_image': False,
 'remove_paragraph_spacing': False,
 'remove_paragraph_spacing_indent_size': 1.5,
 'render_tables_as_images': False,
 'renumber_headings': True,
 'replace_scene_breaks': u'',
 'sans_family': u'None',
 'series': None,
 'series_index': None,
 'serif_family': u'None',
 'smarten_punctuation': False,
 'sr1_replace': None,
 'sr1_search': None,
 'sr2_replace': None,
 'sr2_search': None,
 'sr3_replace': None,
 'sr3_search': None,
 'tags': None,
 'text_size_multiplier_for_rendered_tables': 1.0,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2,
 'wordspace': 2.5}
InputFormatPlugin: MOBI Input running
on /data/books/AUTHOR/BOOKNAME/mybook.prc
Traceback (most recent call last):
  File "site.py", line 58, in main
  File "site-packages/calibre/utils/ipc/worker.py", line 119, in main
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 920, in run
  File "site-packages/calibre/customize/conversion.py", line 204, in __call__
  File "site-packages/calibre/ebooks/mobi/input.py", line 27, in convert
  File "site-packages/calibre/ebooks/mobi/reader.py", line 308, in extract_content
DRMError

So I tried with the commandline directly, using mobidedrm.py

Code:

python mobidedrm.py 1.prc out.prc PIIII\$ID
MobiDeDrm v0.20. Copyright 2008-2010 The Dark Reverser.
MOBI header version = 6, length = 232
Extra Data Flags = 10
Error: no key found. maybe the PID is incorrect

where PIIII\$ID is the PID I got by running mobipocket reader (v.62, again on wine), because I had no other clue where to find the PID.

Any ideas? Even I pointer to where to start would be appreciated.

/dr

Stream Recorder 05-02-2011 02:40 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
If you use Kindle for PC, you do not need PID. But I have no idea whether K4PC works correctly when using WINE or not.

Do you use Linux or Mac OS?

drsquash 05-02-2011 08:38 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
Thanks for the reply.
I use linux, but why could kindle 4 pc behave differently? It's just downloading the prc file on the hard drive. It should not be "aware" that is being run withine iwine.

/dr

Stream Recorder 05-02-2011 09:09 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
WINE is just an emulator. Some programs work fine when you use it, but many other don't. May be Kindle for PC works fine. May be you just need to find the PID from it, but I don't know how to do it.

Another problem is that I don't know how to find PID for Kindle for Android.

If you buy your ebooks on a PC, Mac or iPhone, there shouldn't be any problems.

Right now I can only suggest to keep bugging the developers of DRM removal tools to support devices that you have.

drsquash 05-02-2011 02:45 PM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
Thanks for your help. I will try to look more around, maybe have a look at the source code one of these days.

It is a bit sad: I want to buy book and just read them on the device I choose, I would not like to download an ebook from torrent, but they are really asking for it...

/dr

Stream Recorder 05-04-2011 01:35 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
I tried to use Kindle for PC 1.0.1 and 1.50 with K4MobiDeDRM_v02.8_plugin.zip plugin for Calibre on Ubuntu 11.04 x64 and it didn't work (for PRC files from K4PC 1.0.1 and for AZW files from K4PC 1.50).



In Windows it is important to use Python 2.6 x32. I wonder whether my 64-bit installation and/or other version of Python are to blame.

drsquash 05-04-2011 08:09 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
Maybe. I read somewhere that issue about the 32 bit version of the python library. I did not want to try it in the beginning, but since there seem not to be other solutions i will try. Probably this weekend though.

/dr

Ripper 05-08-2011 11:59 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
Quote:

Originally Posted by drsquash (Post 28421)
hi there,

I just bought a book on Amazon, and I would like to read it also on my sony prs. Needless to say, I need to get rid of the DRM.

I use Calibre, so I installed the latest version of the drm tools, all went fine. I installed Kindle for PC on wine-1.3 (both the current updated version and an older one) and I downloaded on the hard drive the book I bought as a prc file (the first time, I downloaded the book on my android phone, with the kindle app, but I did not manage to find it in the filesystem). I thought I read that if you use Kindle for PC, you need nor a serial nor a PID. I just tried importing the book with calibre, but I get this error message

Code:

Error decoding: /home/blabla/My Kindle Content/mybook.prc
the book is in the collection however, so I tried to convert it in order to get some more verbose error message. When I try to convert to lrf I get:


Code:

calibre, version 0.7.58
ERROR: Conversion Error: <b>Failed</b>: Convert book 1 of 1 (BOOKNAME)

Convert book 1 of 1 (BOOKNAME)
Resolved conversion options
calibre version: 0.7.58
{'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0.0,
 'book_producer': None,
 'change_justification': 'original',
 'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\\s+', 'i')) or @class = 'chapter']",
 'chapter_mark': u'pagebreak',
 'comments': None,
 'cover': u'/tmp/calibre_0.7.58_tmp_Nn4kaW/calibre_0.7.58_7viLlp.jpeg',
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'enable_autorotation': False,
 'enable_heuristics': False,
 'extra_css': None,
 'fix_indents': True,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'header': False,
 'header_format': u'%t by %a',
 'header_separation': 0.0,
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x37bd810>,
 'insert_blank_line': False,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'language': None,
 'level1_toc': None,
 'level2_toc': None,
 'level3_toc': None,
 'line_height': 0.0,
 'linearize_tables': False,
 'margin_bottom': 5.0,
 'margin_left': 5.0,
 'margin_right': 5.0,
 'margin_top': 5.0,
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_indent': 0.0,
 'minimum_line_height': 120.0,
 'mono_family': u'None',
 'no_chapters_in_toc': False,
 'no_inline_navbars': False,
 'output_profile': <calibre.customize.profiles.SonyReaderOutput object at 0x37c30d0>,
 'page_breaks_before': u"//*[name()='h1' or name()='h2']",
 'prefer_metadata_cover': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/tmp/calibre_0.7.58_tmp_Nn4kaW/calibre_0.7.58_JU5sCu.opf',
 'remove_fake_margins': True,
 'remove_first_image': False,
 'remove_paragraph_spacing': False,
 'remove_paragraph_spacing_indent_size': 1.5,
 'render_tables_as_images': False,
 'renumber_headings': True,
 'replace_scene_breaks': u'',
 'sans_family': u'None',
 'series': None,
 'series_index': None,
 'serif_family': u'None',
 'smarten_punctuation': False,
 'sr1_replace': None,
 'sr1_search': None,
 'sr2_replace': None,
 'sr2_search': None,
 'sr3_replace': None,
 'sr3_search': None,
 'tags': None,
 'text_size_multiplier_for_rendered_tables': 1.0,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2,
 'wordspace': 2.5}
InputFormatPlugin: MOBI Input running
on /data/books/AUTHOR/BOOKNAME/mybook.prc
Traceback (most recent call last):
  File "site.py", line 58, in main
  File "site-packages/calibre/utils/ipc/worker.py", line 119, in main
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 920, in run
  File "site-packages/calibre/customize/conversion.py", line 204, in __call__
  File "site-packages/calibre/ebooks/mobi/input.py", line 27, in convert
  File "site-packages/calibre/ebooks/mobi/reader.py", line 308, in extract_content
DRMError

So I tried with the commandline directly, using mobidedrm.py

Code:

python mobidedrm.py 1.prc out.prc PIIII\$ID
MobiDeDrm v0.20. Copyright 2008-2010 The Dark Reverser.
MOBI header version = 6, length = 232
Extra Data Flags = 10
Error: no key found. maybe the PID is incorrect

where PIIII\$ID is the PID I got by running mobipocket reader (v.62, again on wine), because I had no other clue where to find the PID.

Any ideas? Even I pointer to where to start would be appreciated.

/dr

Your AZW file will be saved in Calibre after you receive the error message with DRM still in it. calibre convert the AZW book to MOBI format, make a copy of the MOBI file where you can find it later, remove the MOBI file from calibre, and then add the MOBI file copy you saved to calibre and I believe you will have a DRM free MOBI file. You should not see any error message when you add the MOBI file this time. You may then convert it back to a DRM free AZW file if you wish. Make sure to first remove the original AZW file from calibre. For some reason this workaround seems to work in Kindle for PC files while the direct DRM removal for AZW does not.

drsquash 05-09-2011 03:08 PM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
Thanks, I appreciate your help. However it does not seem to work.
I tried both with Kindle for PC 1 (it downloaded a prc and mbp file) and 1.1 (it downloaded azw and mbp file).
When I open them with Calibre, I get the error message, and then, it's true, the file is stored within a Calibre directory. However, the file is just copied. If I diff the Calibre-contained file and the original one, I get a binary match.

I am wondering what the mbp file is for. I tried deleting it, but I can still read it with K4PC, that after a while regenerates it. Is it just a bookmark index or something like that?

/dr

waryde 05-11-2011 07:40 AM

Re: Remove Kindle DRM in Linux: FindPID to read Amazon .PRC/.AZW book on Sony Reader


 
You still need a PID, the plugin just reads it from somewhere on Windows.
Wine just emulates Windows, so the plugin cannot find it!
Maybe you can install the Windows Version of Calibre in Wine and it works. If not, you have to use Windows or modify the plugin yourself so it can find the PID on a virtualized Kindle for PC in Wine too.


All times are GMT -6. The time now is 06:24 PM.