noDRM / DeDRM_tools

DeDRM tools for ebooks
7.1k stars 317 forks source link

B&N PDF do not get DeDRMed #640

Open tzachyb opened 1 week ago

tzachyb commented 1 week ago

Question / bug report

Unable to deDRM a B&N PDF. Was able to de-DRM most other books from B&N, and book displays fine in the Nook for Windows app. Willing to lend book if requested.

Side note, the process that works to get B&N Nook App for Windows installed and successfully download the files is as follows:

  1. Download but do not install BarnesNoble.Nook_1.11.0.4_x86__ahnzqzva31enc.Appx (details at https://www.mobileread.com/forums/showthread.php?p=4414584&nojs=1 )
  2. From the same site also download Microsoft.VCLibs.120.00_12.0.21005.1_x86__8wekyb3d8bbwe.Appx
  3. Install via Elevated Rights PowerShell the VCLibs library, along the lines of: Add-AppxPackage -Path "_C:\Path\to_Microsoft.VCLibs.120.00_12.0.21005.1_x86__8wekyb3d8bbwe.Appx" (details at https://www.thewindowsclub.com/how-to-install-unsigned-appx-app-package-using-powershell-in-windows-10 )
  4. Only after the VCLibs were installed, install also via Elevated PowerShell the B&N Nook for Windows apps, Add-AppxPackage -Path "_C:\Path\to_BarnesNoble.Nook_1.11.0.4_x86__ahnzqzva31enc.Appx"
  5. Open Nook for Windows and download desired books. Exit up.
  6. The books (and DB3 files if needed) will be found at C:\Users_Your_username\AppData\Local\Packages\BarnesNoble.Nook_ahnzqzva31enc\LocalState

Tips: Nook for Windows will not install if the appropriate VCLibs are not installed first; If installed via double-click, Nook for Windows will display Library but will not download any books; the content of missing rights.xml should be found in the NookDownloads.db3: open in sqlite and run "select license from download_doc where ean=ISBN-of-book;" (the ISBN is also the first part of the filename).

Which version of Calibre are you running?

7.19

Which version of the DeDRM plugin are you running?

v10.0.3

If applicable, which version of the Kindle software are you running?

No response

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
calibre Debug log
calibre 7.19  embedded-python: True
Windows-10-10.0.22631-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22631')
Python 3.11.5
Windows: ('10', '10.0.22631', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: G:\My Drive\PortableApps\calibrePortable\App\Calibre\calibre-debug.exe
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0) && KindleUnpack - The Plugin (0, 83, 1)
calibre 7.19  embedded-python: True
Windows-10-10.0.22631-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22631')
Python 3.11.5
Windows: ('10', '10.0.22631', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: G:\My Drive\PortableApps\calibrePortable\App\Calibre\calibre-debug.exe
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0) && KindleUnpack - The Plugin (0, 83, 1)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 109.4937343358396 x 109.18208955223879
[0.00] Starting up...
[0.00] Showing splash screen...
[1.23] splash screen shown
[1.23] Initializing db...
[1.44] db initialized
[1.44] Constructing main UI...
[9.03] GUI main window shown
[9.77] main UI initialized...
[9.77] Hiding splash screen
[9.77] splash screen hidden
[9.77] Started up in 9.77 seconds with 0 books
DeDRM v10.0.3: Trying to decrypt 9781571209047.pdf
DeDRM v10.0.3: 9781571209047.pdf is a PDF ebook with encryption EBX_HANDLER
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "encodings\hex_codec.py", line 19, in hex_decode
ValueError: string argument should contain only ASCII characters

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "calibre\customize\ui.py", line 199, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1063, in run
  File "calibre_plugins.dedrm.__init__", line 923, in PDFDecrypt
  File "calibre_plugins.dedrm.__init__", line 718, in PDFIneptDecrypt
ValueError: decoding with 'hex' codec failed (ValueError: string argument should contain only ASCII characters)
Traceback (most recent call last):
  File "calibre\customize\ui.py", line 481, in get_file_type_metadata
  File "calibre\customize\builtins.py", line 325, in get_metadata
  File "calibre\ebooks\metadata\pdf.py", line 126, in get_metadata
ValueError: Could not read info dict from PDF
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler
pdfinfo errored out with return code: 1
Added 9781571209047 to db in: 1.6
Added 1 books in 23.9 seconds
ElleKayEm commented 1 week ago

For a long time DeDRM did not handle B&N PDFs. Then a script was contributed, but not incorporated into the plugin. Then it was incorporated, but I don't know if it was really tested. There are some other PDF related fixes in DeDRM 10.0.9: https://github.com/noDRM/DeDRM_tools/releases/tag/v10.0.9

The absolute latest alpha auto-release is here: https://github.com/noDRM/DeDRM_tools_autorelease/releases