apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.46k stars 1.49k forks source link

Unable to Remove DRM with Obok #1476

Open fmdmf opened 3 years ago

fmdmf commented 3 years ago

Hello. I'm a bit new to this plugin, so my apologies if I miss anything obvious. I am trying to remove the DRM from books that I purchased on the Kobo store. I downloaded them using the Kobo Desktop App and tried to import them via Calibre's Obok plugin (using Calibre 4.23 and Obok v6.7). The pop up said that there were no issues, but of the 79 books I imported, only one had had its DRM removed. The rest did not, and the majority of them showed a short sequence of letters for their titles and 'Author Unknown' for their authors. Only four had the correct titles and author name, but they too could not be opened in Calibre.

I would greatly appreciate any help with this.

I am using Windows 10.

Here is the log from one of the books:

calibre Debug log calibre 4.23 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041-SP0 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 2.7.16+ Windows: ('10', '10.0.19041', 'SP0', u'Multiprocessor Free') Interface language: en_GB Failed to initialize plugin: u'C:\Users\name\AppData\Roaming\calibre\plugins\DeDRM.zip' Traceback (most recent call last): File "site-packages\calibre\customize\ui.py", line 703, in initialize_plugins File "site-packages\calibre\customize\ui.py", line 61, in load_plugin File "site-packages\calibre\customize\zipplugin.py", line 221, in load InvalidPlugin: The plugin at C:\Users\name\AppData\Roaming\calibre\plugins\DeDRM.zip needs a version of calibre >= 5.0.0 Successfully initialized third party plugins: FanFicFare (3, 27, 0) && KePub Metadata Writer (3, 2, 12) && KePub Metadata Reader (3, 4, 3) && Obok DeDRM (6, 7, 0) calibre 4.23 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041-SP0 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 2.7.16+ Windows: ('10', '10.0.19041', 'SP0', u'Multiprocessor Free') Interface language: en_GB Successfully initialized third party plugins: FanFicFare (3, 27, 0) && KePub Metadata Writer (3, 2, 12) && KePub Metadata Reader (3, 4, 3) && Obok DeDRM (6, 7, 0) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 120.0 x 120.0 physicalDpi: 117.584086799 x 117.607717042 Using calibre Qt style: True [0.00] Starting up... [0.02] Showing splash screen... [0.53] splash screen shown [0.53] Initializing db... [0.53] db initialized [0.53] Constructing main UI... DEPRECATION: The OpenSSL being used by this python install (OpenSSL 1.0.2s 28 May 2019) does not meet the minimum supported version (>= OpenSSL 1.1.1) in order to support TLS 1.3 required by Cloudflare, You may encounter an unexpected Captcha or cloudflare 1020 blocks. DEBUG: 0.0 obok::utilities.py - loading translations DEBUG: 0.0 obok::dialogs.py - loading translations DEBUG: 0.0 obok::config.py - loading translations DEBUG: 0.0 obok::action_err.py - loading translations Loaded cached store plugin for: Amazon Kindle at version: 19 Loaded cached store plugin for: Amazon FR Kindle at version: 16 Loaded cached store plugin for: Project Gutenberg at version: 7 Loaded cached store plugin for: Google Books at version: 7 Loaded cached store plugin for: Nexto at version: 6 Loaded cached store plugin for: ebook.de at version: 6 FFF: INFO: 2021-01-12 00:59:39,729: calibre_plugins.fanficfare_plugin.prefs(215): Attempting to read settings from predecessor--FFDL FFF: INFO: 2021-01-12 00:59:39,729: calibre_plugins.fanficfare_plugin.prefs(220): Using default settings FFF: DEBUG: 2021-01-12 00:59:39,742: calibre_plugins.fanficfare_plugin.fff_plugin(221): Plugin FanFicFare macmenuhack file_path:C:\Users\name\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt [3.28] main UI initialized... [3.28] Hiding splash screen [17.98] splash screen hidden [17.98] Started up in 17.98 seconds with 34 books Running Obok DeDRM v6.7.0 DEBUG: 315.4 didn't find device Obok v3.2.4 Copyright © 2012-2016 Physisticated et al. c:\users\name\appdata\local\temp\tmpvvd87j DEBUG: 315.4 got kobodir C:\Users\name\AppData\Local\Kobo\Kobo Desktop Edition Found 24 possible keys to try. DEBUG: 534.9 BookListTableWidget:get_books - book_num: 1 DEBUG: 534.9 BookListTableWidget:get_books - book: 銀魂 モノクロ版 1 DEBUG: 534.9 InterfacePluginAction::launchObok - number of books to decrypt: 1 Obok DeDRM v6.7.0 - Decrypting 銀魂 モノクロ版 1 Trying key: f5c3f23f6431ee08da5e738974b871f5 Success! Traceback (most recent call last): File "site-packages\calibre\customize\ui.py", line 428, in get_file_type_metadata File "site-packages\calibre\customize\builtins.py", line 195, in get_metadata File "site-packages\calibre\ebooks\metadata\epub.py", line 218, in get_metadata File "site-packages\calibre\ebooks\metadata\epub.py", line 156, in read_bytes File "site-packages\calibre\utils\zipfile.py", line 999, in read File "site-packages\calibre\utils\zipfile.py", line 1027, in open File "site-packages\calibre\utils\zipfile.py", line 989, in getinfo KeyError: u"There is no item named 'OPS/advanced.opf' in the archive" DEBUG: 536.8 DecryptAddProgressDialog::do_book_action - decrypted book: '銀魂 モノクロ版 1' Obok DeDRM v6.7.0 - Added ekwno4 Obok DeDRM v6.7.0 - wrapping up results.

ElleKayEm commented 3 years ago

Yeah, I don't know anyway to not update. So 4.26.14705 must be the latest. The "about" gives a date of 10 Feb 2021 for it.

fmdmf commented 3 years ago

I see. I suppose I will have to update it then. I'll try doing that and running the plugin again, to see if it works.

caifara commented 3 years ago

No luck here with the following error:

calibre, version 5.21.0 ERROR: Unhandled exception: OperationalError:no such table: content_keys

calibre 5.21 embedded-python: True is64bit: True macOS-10.16-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '20.3.0', 'Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64') Python 3.8.5 OSX: ('10.16', ('', '', ''), 'x86_64') Interface language: None Successfully initialized third party plugins: DeDRM (7, 2, 1) && Obok DeDRM (7, 2, 1) Traceback (most recent call last): File "calibre_plugins.obok_dedrm.action", line 108, in launchObok books = self.build_book_list() File "calibre_plugins.obok_dedrm.action", line 211, in build_book_list return self.library.books File "calibre_plugins.obok_dedrm.obok.obok", line 450, in books for row in self.__cursor.execute('SELECT DISTINCT volumeid, Title, Attribution, Series FROM content_keys, content WHERE contentid = volumeid'): sqlite3.OperationalError: no such table: content_keys

Also:

Kobo Desktop Edition 4.26.12741

ElleKayEm commented 3 years ago

Obok 7.2.1 wouldn't work for me. I had to go back to 7.1.0. I'm on Windows though.

fmdmf commented 3 years ago

Updated the Kobo Desktop App, but it seems Obok still doesn't work. It loads into Calibre's library, but the name of the book is gibberish and opening it gives an error.

Though there is a new development - if I try to run Obok on 64-bit Calibre 4.23.0, I get:

calibre, version 4.23.0 ERROR: Unhandled exception: ImportError:No module named winreg

Windows 10 Kobo Desktop Edition 4.28.15727

ElleKayEm commented 3 years ago

For calibre 4.23, you need the Obok from 6.8.1. If you update to calibre 5.x and the current Obok 7.2.1 doesn't work, give the one in this comment a try: https://github.com/apprenticeharper/DeDRM_tools/issues/1718#issuecomment-874246085

fmdmf commented 3 years ago

Ah, I see, so the new version still doesn't work with 4.23? I'll reinstall 6.8.1 then. Thanks for letting me know.

I uninstalled Obok 7.2.1 on Caliber 5.5 and installed the fix you linked. Unfortunately I'm getting the same results.

The error given when I try to open the file imported into Calibre (which still has no cover image or an intelligible name):

calibre, version 5.5.0 ERROR: Loading book failed: Failed to open the book at D:\CALIBRE\Unknown\4qt3wivk (714)\4qt3wivk - Unknown.epub. Click "Show details" for more info.

Failed to convert book: D:\CALIBRE\Unknown\4qt3wivk (714)\4qt3wivk - Unknown.epub with error: DeDRM v7.2.1: Trying to decrypt 4qt3wivk - Unknown.epub DeDRM v7.2.1: Verifying zip archive integrity DeDRM v7.2.1: “4qt3wivk - Unknown.epub” is neither an Adobe Adept nor a Barnes & Noble encrypted ePub InputFormatPlugin: EPUB Input running on D:\CALIBRE\Unknown\4qt3wivk (714)\4qt3wivk - Unknown.epub Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main() Traceback (most recent call last): File "calibre\customize\ui.py", line 428, in get_file_type_metadata File "calibre\customize\builtins.py", line 194, in get_metadata File "calibre\ebooks\metadata\epub.py", line 238, in get_quick_metadata File "calibre\ebooks\metadata\epub.py", line 218, in get_metadata File "calibre\ebooks\metadata\epub.py", line 156, in read_bytes File "calibre\utils\zipfile.py", line 1006, in read File "calibre\utils\zipfile.py", line 1034, in open File "calibre\utils\zipfile.py", line 995, in getinfo KeyError: "There is no item named 'OPS/advanced.opf' in the archive" Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 644, in run File "calibre_plugins.dedrm.init", line 420, in ePubDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Couldn't decrypt after 7.7 seconds. DRM free perhaps? Traceback (most recent call last): File "runpy.py", line 194, in _run_module_as_main File "runpy.py", line 87, in _run_code File "site.py", line 82, in File "site.py", line 77, in main File "site.py", line 49, in run_entry_point File "calibre\utils\ipc\worker.py", line 195, in main File "", line 1, in File "calibre\srv\render_book.py", line 865, in viewer_main File "calibre\srv\render_book.py", line 856, in render_for_viewer File "calibre\srv\render_book.py", line 834, in render File "calibre\srv\render_book.py", line 649, in process_exploded_book File "calibre\srv\render_book.py", line 333, in create_cover_page File "calibre\srv\render_book.py", line 286, in find_epub_cover File "calibre\ebooks\oeb\polish\cover.py", line 287, in find_cover_image_in_page File "src/lxml/xpath.pxi", line 430, in lxml.etree.XPath.call File "src/lxml/apihelpers.pxi", line 41, in lxml.etree._documentOrRaise TypeError: Invalid input object: bytes

ElleKayEm commented 3 years ago

The current version of Obok is Python 3 and isn't going to work with calibre 4.23 which is Python 2.

Let's see a log of importing the book with Obok.

All we see here is DeDRM which is for Adobe DRM, not Kobo's.

fmdmf commented 3 years ago

Odd. I used the Obok icon when I imported it.

Here is the log, using Calibre 5 and the Obok plugin:

FFF: INFO: 2021-07-14 03:50:07,890: calibre_plugins.fanficfare_plugin.prefs(215): Attempting to read settings from predecessor--FFDL FFF: INFO: 2021-07-14 03:50:07,890: calibre_plugins.fanficfare_plugin.prefs(220): Using default settings FFF: DEBUG: 2021-07-14 03:50:07,902: calibre_plugins.fanficfare_plugin.fff_plugin(221): Plugin FanFicFare macmenuhack file_path:C:\Users\user\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt calibre Debug log calibre 5.5 embedded-python: True is64bit: False Windows-10-10.0.19041 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: en_GB Successfully initialized third party plugins: DeDRM (7, 2, 1) && FanFicFare (3, 27, 0) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 2, 12) && Obok DeDRM (7, 2, 1) calibre 5.5 embedded-python: True is64bit: False Windows-10-10.0.19041 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: en_GB Successfully initialized third party plugins: DeDRM (7, 2, 1) && FanFicFare (3, 27, 0) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 2, 12) && Obok DeDRM (7, 2, 1) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 120.0 x 120.0 physicalDpi: 117.58408679927668 x 117.60771704180064 Using calibre Qt style: True [0.00] Starting up... [0.00] Showing splash screen... [0.66] splash screen shown [0.66] Initializing db... [0.66] db initialized [0.66] Constructing main UI... DEBUG: 0.0 obok::utilities.py - loading translations DEBUG: 0.0 obok::dialogs.py - loading translations DEBUG: 0.0 obok::config.py - loading translations DEBUG: 0.0 obok::action_err.py - loading translations Loaded cached store plugin for: Amazon FR Kindle at version: 16 Loaded cached store plugin for: Nexto at version: 6 [2.38] main UI initialized... [2.38] Hiding splash screen Starting QuickView Traceback (most recent call last): File "calibre\customize\ui.py", line 428, in get_file_type_metadata File "calibre\customize\builtins.py", line 195, in get_metadata File "calibre\ebooks\metadata\epub.py", line 218, in get_metadata File "calibre\ebooks\metadata\epub.py", line 156, in read_bytes File "calibre\utils\zipfile.py", line 1006, in read File "calibre\utils\zipfile.py", line 1034, in open File "calibre\utils\zipfile.py", line 995, in getinfo KeyError: "There is no item named 'OPS/advanced.opf' in the archive" [9.78] splash screen hidden [9.78] Started up in 9.78 seconds with 37 books Running Obok DeDRM v7.2.1 DEBUG: 9.2 didn't find device Obok v4.0.0 Copyright © 2012-2020 Physisticated et al. C:\Users\user\AppData\Local\Temp\tmp2gwfh0c7 DEBUG: 9.3 got kobodir C:\Users\user\AppData\Local\Kobo\Kobo Desktop Edition Found 24 possible keys to try. DEBUG: 15.5 BookListTableWidget:get_books - book_num: 80 DEBUG: 15.5 BookListTableWidget:get_books - book: 銀魂公式ファンブック 広侍苑 DEBUG: 15.5 InterfacePluginAction::launchObok - number of books to decrypt: 1 Obok DeDRM v7.2.1 - Decrypting 銀魂公式ファンブック 広侍苑 Trying key: b'f5c3f23f6431ee08da5e738974b871f5' Success! DEBUG: 22.6 DecryptAddProgressDialog::do_book_action - decrypted book: '銀魂公式ファンブック 広侍苑' Obok DeDRM v7.2.1 - Added 1m ufgxk Obok DeDRM v7.2.1 - wrapping up results.

ElleKayEm commented 3 years ago

Is this regular Obok 7.2.1?

fmdmf commented 3 years ago

It should be the fix that you linked me in your earlier post.

ElleKayEm commented 3 years ago

Ok, here's another one. This was in response to someone whose book was also saying it was decrypted but wasn't. From the same thread, but different comment: https://github.com/apprenticeharper/DeDRM_tools/issues/1718#issuecomment-869744457

fmdmf commented 3 years ago

Thank you for the link. But it seems to be the same comment? (1718)

ElleKayEm commented 3 years ago

No, same thread (1718), earlier comment.

fmdmf commented 3 years ago

The one by ableeker?

ElleKayEm commented 3 years ago

I'll attach it here. Obok_plugin.zip

fmdmf commented 3 years ago

Thank you. I uninstalled the plugin I had and installed this one. The problem persists.

build6 commented 2 years ago

I would like to report that Obok in the latest DeDRM 7.2.1 (with Calibre 5.3.2) is unable to remove DRM (the .epub produced is gibberish/not properly decrypted) BUT when I try with an older Calibre (4.23) with older Obok (6.7) it works fine. Some kind of regression

ElleKayEm commented 2 years ago

See reply here: https://github.com/apprenticeharper/DeDRM_tools/issues/1960#issuecomment-989929498

build6 commented 2 years ago

See reply here: #1960 (comment)

can confirm the newer version fixes the problem, thank you