Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to strip images inside .azw.res? (AZW6 Support?) #483

Closed
choryuidentify opened this issue Apr 16, 2018 · 26 comments
Closed

How to strip images inside .azw.res? (AZW6 Support?) #483

choryuidentify opened this issue Apr 16, 2018 · 26 comments

Comments

@choryuidentify
Copy link

choryuidentify commented Apr 16, 2018

Hi!
I have some Kindle Japanese Light Novel things. so I've convert these books using calibre and this plugin, but strangely book size (1.8M) is diffrent to Amazon's say (8M) and too small, and Image quality is bad.

I'm googling these problem, and finally I have get doubt to '.azw.res' file. This file is very big (6.2M) and someone says that file have encrypted HD-quality image.

I've attach my log below.
Please told me, It really decrypt or strip .azw.res? if not, How to strip '.azw.res' file?

calibre 3.21 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.16299-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.16299')
Python 2.7.12+
Windows: ('10', '10.0.16299', 'SP0', u'Multiprocessor Free')
Interface language: ko
Successfully initialized third party plugins: Gather KFX-ZIP File Type (from KFX Input) (1, 3, 0) && DeDRM (6, 6, 0) && Package KFX File Type (from KFX Input) (1, 3, 0) && KFX metadata reader (from KFX Input) (1, 3, 0) && KFX Input (1, 3, 0)
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 99.2372093023 x 102.576923077
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.11] splash screen shown
[0.11] Initializing db...
[0.12] db initialized
[0.12] Constructing main UI...
[2.09] main UI initialized...
[2.09] Hiding splash screen
[2.59] splash screen hidden
[2.59] Started up in 2.59 seconds with 1 books
Gather KFX-ZIP File Type (from KFX Input) 1.3.0: Importing C:/Users/sec/Documents/My Kindle Content/B01GE0U4GO_EBOK/B01GE0U4GO_EBOK.azw
KFX Input: File is not KFX format
DeDRM v6.6.0: Trying to decrypt B01GE0U4GO_EBOK.azw
Using Library AlfCrypto Python
MobiDeDrm v0.42.
Copyright © 2008-2017 The Dark Reverser, Apprentice Harper et al.
Decrypting Kindle Format 8 ebook: [BOOK NAME MASKED]
Found 0 keys to try after 0.3 seconds
Crypto Type is: 2
DeDRM v6.6.0: Failed to decrypt with error: No key found in 0 keys tried.
DeDRM v6.6.0: Looking for new default Kindle Key after 0.3 seconds
searching for kinfoFiles in C:\Users\sec\AppData\Local
Found K4PC 1.9+ kinf2011 file: C:\Users\sec\AppData\Local\Amazon\Kindle\storage.kinf2011
Decrypted key file using IDString '4108899827' and UserName '736563'
DeDRM v6.6.0: Found 1 new key
MobiDeDrm v0.42.
Copyright © 2008-2017 The Dark Reverser, Apprentice Harper et al.
Decrypting Kindle Format 8 ebook: [BOOK NAME MASKED]
Got DSN key from database default_key_1
Found 4 keys to try after 0.4 seconds
Crypto Type is: 2
File is encoded with PID GNO83ag+HJ.
Decrypting. Please wait . . . . done
Decryption succeeded after 1.7 seconds
DeDRM v6.6.0: Saving 1 new key
DeDRM v6.6.0: Finished after 1.7 seconds
C:\Program Files\Calibre2\app\pylib.zip\dateutil\parser.py:601: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
Added [BOOK NAME MASKED] to db in: 0.9
Added 1 books in 5.2 seconds

@choryuidentify choryuidentify changed the title How to strip images in .azw.res? How to strip images inside .azw.res? Apr 16, 2018
@ElleKayEm
Copy link

Sounds like it's an AZW6 file. Those will have the book split into two files: one for the text and AZW6 for the images. Calibre will only import the main book file. If you have an E-ink Kindle, you can download the book from the "Manage your content and devices" page for "download & transfer via USB." This will give you a single AZW3 file. This can be decrypted if you add the E-ink Kindle's serial number into the plugin customization.

@choryuidentify
Copy link
Author

Okay... I just bought used Kindle Paperwhite 2. Thanks!

@choryuidentify
Copy link
Author

I've tried to download AZW3 file to @ElleKayEm way, But I can get small main book file only. Still 1.8M, and Image is small. There is really no another way to decrypt this?

@ElleKayEm
Copy link

Not that I'm aware of...at least not with these tools right now.

@choryuidentify
Copy link
Author

That's sad... I'll waiting that always!

@choryuidentify choryuidentify changed the title How to strip images inside .azw.res? How to strip images inside .azw.res? (AZW6 Support?) Apr 18, 2018
@choryuidentify
Copy link
Author

choryuidentify commented Apr 18, 2018

WOW! Finally! I've found tool from this post!
Named 'DumpAZW6', It's works perfectly on .azw.res!

Dump step;

  1. Rename .azw.res to .azw6
  2. Install python 2 (not 3!)
  3. This step is unnecessary to linux.
    3-1. If you on Windows, and not works this script on cmd.exe, Install PyCharm, Make new project, copy code, and set argument file, and run. (It looks UTF-8 failure)
    3-2. In Japanese book, try chcp 932 before run python DumpAZW6_v01.py %FILENAME% on cmd.exe. It print broken book name, but Image is successfully dumped.
  4. run python DumpAZW6_v01.py %FILENAME%
  5. Done!

@ElleKayEm
Copy link

Glad you figured it out. And thanks for reporting back.

@apprenticeharper
Copy link
Owner

If anyone would like to try integrating DumpAZW6 into the tools, to produce a decrypted KF8 book that uses the high resolution images from the associated AZW6 file, I'd be delighted to receive a pull request.

@choryuidentify
Copy link
Author

I make the patch for support this. Please test it guys!

@Bitwolfies
Copy link

How exactly do I use this part of the plugin? I have no idea what im doing for AZW6

@choryuidentify
Copy link
Author

@Darkwolf1515 What's your purpose? This issue are depends on image resolutions of Kindle book.

If yes, remove calibre DeDRM plugin and install this.
https://github.com/choryuidentify/DeDRM_tools/releases/tag/v6.6.3-patched

That plugin is based on old DeDRM (6.6.3). so can have bugs.

@ElleKayEm
Copy link

It isn't part of the official DeDRM plugin. It's a separate Python script.

@Bitwolfies
Copy link

@Darkwolf1515 What's your purpose? This issue are depends on image resolutions of Kindle book.

If yes, remove calibre DeDRM plugin and install this.
https://github.com/choryuidentify/DeDRM_tools/releases/tag/v6.6.3-patched

That plugin is based on old DeDRM (6.6.3). so can have bugs.

Right, I tried your version, wasn't able to make it work, left the file name as .azw.res, tried renaming to azw and azw6, nothing worked.

@ElleKayEm
Copy link

@Darkwolf1515

What OS and how are downloading the book?

@Bitwolfies
Copy link

Bitwolfies commented Jul 16, 2020

@Darkwolf1515

What OS and how are downloading the book?

Windows 10, kindle, latest version which is probably my issue I'd say. But I've had no issue with non .res files.

@ElleKayEm
Copy link

ElleKayEm commented Jul 16, 2020

Yes, I think the older version of DeDRM choryuidentify's version is based on will need at least Kindle for PC version 1.24 or earlier.

@Bitwolfies
Copy link

Yes, I think the older version of DeDRM choryuidentify's version is based on will need at least Kindle for PC version 1.24 or earlier.

Is there a safe way to get older versions?

And will they have any effect on quality?

@ElleKayEm
Copy link

There's info near the bottom of the first post here: https://www.mobileread.com/forums/showthread.php?t=283371

Try looking for 1.17.

@ElleKayEm
Copy link

Older version of K4PC won't matter for AZW6 format. Later versions allow the new KFX format and have a different DRM key.

@Bitwolfies
Copy link

Older version of K4PC won't matter for AZW6 format. Later versions allow the new KFX format and have a different DRM key.

Downgraded, wont download the higher quality version. Gonna try the powershell script.

@Bitwolfies
Copy link

Older version of K4PC won't matter for AZW6 format. Later versions allow the new KFX format and have a different DRM key.

Downgraded, wont download the higher quality version. Gonna try the powershell script.

Doing this also refuses to download the higher quality images, guess I just have to hope this plugin gets updated.

@ElleKayEm
Copy link

Hmm, I guess K4PC 1.17 is too old. Possibly 1.24 would work, but I don't know the info to find a valid copy of that version.

@Bitwolfies
Copy link

Hmm, I guess K4PC 1.17 is too old. Possibly 1.24 would work, but I don't know the info to find a valid copy of that version.

Nope sadly, .res

@ElleKayEm
Copy link

Maybe use kindlekey.py from DeDRM 6.8.0.

@choryuidentify
Copy link
Author

Hmm, I guess K4PC 1.17 is too old. Possibly 1.24 would work, but I don't know the info to find a valid copy of that version.

Nope sadly, .res

I'm using Kindle 1.28 (yeah, pretty recent version) with my patched plugin, installed on Calibre 4.21 64bit. old Kindle for Windows didn't download resource file.
Make sure your book is really download spllited book (Book directory must be contains .azw, .azw.res both). Some books are not spllited. Compare book file size and Kindle store's book size.

and, One directory must has just one .azw.res. more than one, Image merge will be skipped.

My patched plugin is based on old version, so may can't load Kindle decrypt key properly. so I recommand install old Kindle, login, and test decrypting. If decrypted book successfully, upgrade to recent Kindle and test merging.

My working process is this (tested now);

  1. Download book using Kindle
  2. Going to books directory, commonly C:\Users<username>\Documents\My Kindle Content\
  3. Going sub-directory, contains downloaded book. commonly latest created directory.
  4. Check 2 (or 3) files. Just need .azw and .azw.res
  5. Drag n Drop .azw file into Calibre.
  6. Books are automatically decrypted and merged. Check books size. Book size of calibre = .azw + .azw.res (can differ 1~2mb. because on merge process, lower resolution images are removed.)

If don't working after this steps, Trying debug mode of Calibre and reporting back the log.

Thank you for interest my patch!
Good luck!

@Bitwolfies
Copy link

Hmm, I guess K4PC 1.17 is too old. Possibly 1.24 would work, but I don't know the info to find a valid copy of that version.

Nope sadly, .res

I'm using Kindle 1.28 (yeah, pretty recent version) with my patched plugin, installed on Calibre 4.21 64bit. old Kindle for Windows didn't download resource file.
Make sure your book is really download spllited book (Book directory must be contains .azw, .azw.res both). Some books are not spllited. Compare book file size and Kindle store's book size.

and, One directory must has just one .azw.res. more than one, Image merge will be skipped.

My patched plugin is based on old version, so may can't load Kindle decrypt key properly. so I recommand install old Kindle, login, and test decrypting. If decrypted book successfully, upgrade to recent Kindle and test merging.

My working process is this (tested now);

1. Download book using Kindle

2. Going to books directory, commonly C:\Users<username>\Documents\My Kindle Content\

3. Going sub-directory, contains downloaded book. commonly latest created directory.

4. Check 2 (or 3) files. Just need .azw and .azw.res

5. Drag n Drop .azw file into Calibre.

6. Books are automatically decrypted and merged. Check books size. Book size of calibre = .azw + .azw.res (can differ 1~2mb. because on merge process, lower resolution images are removed.)

If don't working after this steps, Trying debug mode of Calibre and reporting back the log.

Thank you for interest my patch!
Good luck!

Downgraded to 1.28. doesnt work sadly, just imports forever. Thanks for all the help, but I guess im just hoping someday there will be another way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants