rmcrackan / Libation

Libation: Liberate your Library
GNU General Public License v3.0
2.76k stars 151 forks source link

Error while trying to process this book #68

Closed rmcrackan closed 3 years ago

rmcrackan commented 3 years ago

@Mbucari , @JakobTischler , @wtanksleyjr

It's my understanding that the decrypt engine is now very mature and yet the 'skip' message is still occurring due to problems downloading/decrypting some books. I just released v5.3.6 with better error messages around this part. If you are still getting this message, can you reply here and say which title is having this issue?

Mbucari commented 3 years ago

So I understand, you don't yet know of any specific books that fail to decrypt?

rmcrackan commented 3 years ago

@Mbucari I don't know of any. There must be some since some users are still seeing the 'skip' message.

There's a feature/work around/hack that if a book is unable to be liberated, then the user has the option to skip it once or skip it forever. This lets them continue on to liberate the rest of their library. The alternative is that on decrypt error, they'd forever be stuck at that point in the loop and unable to liberate the remainder of their library.

wtanksleyjr commented 3 years ago

Great news! Yes, I still have 2 books that have resisted completion since the beginning. (I have copies of them using my old scripts, AAX etc.) Here's a section of my logfile from a relatively recent version (I don't think this is the most new one, I haven't had a chance to get on my big machine).

https://gist.github.com/wtanksleyjr/5c49f0a8cba3482cc95850d740e294ed

Mbucari commented 3 years ago

Thanks! I'll look into it tonight. I'll buy that book, fix AAXClean, then avail myself of Audible's generous return policy.

rmcrackan commented 3 years ago

@Mbucari nothing in Libation is signed. You might be able to offer @wtanksleyjr some drop-in debug builds of AAXClean and use Serilog.Log.Logger to write to the configured Libation log files. I wouldn't want you to have to burn good will with Audible every time you want to debug. They are starting to tighten the reigns on excessive returns.

wtanksleyjr commented 3 years ago

It's true that doing returns puts a mark on your account, and I'm quite willing to do some setup work to try to make this work.

-Wm

On Fri, Jul 23, 2021 at 12:24 PM rmcrackan @.***> wrote:

@Mbucari https://github.com/Mbucari nothing in Libation is signed. You might be able to offer @wtanksleyjr https://github.com/wtanksleyjr some drop-in debug builds of AAXClean and use Serilog.Log.Logger to write to the configured Libation log files. I wouldn't want you to have to burn good will with Audible every time you want to debug. They are starting to tighten the reigns on excessive returns.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-885865499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6IRVZHQICXZPAWVQ4DTZG6W5ANCNFSM5A3FRKJA .

Mbucari commented 3 years ago

What would be really helpful is if you could download the aaxc file and send it to me via dropbox along with the file decryption key, but to do that we'd need to change logging. I'll work on that this afternoon.

rmcrackan commented 3 years ago

That would be a great thing to be able to toggle with just a setting. I recently added a setting to change debug log level. Maybe I need a new tab in Settings for debug options

Mbucari commented 3 years ago

OK, I added logging of the download license to debuginfo. I haven't made a pull request for this change because it is technically personal information. It includes the aax file url containing a voucher allowing the user access to the file for one hour. It also contains the decryption key and initialization vector unique to that aaxc file for that user.

@wtanksleyjr , If you're comfortable comfortable downloading the aaxc file and sending it to me along with the key/iv, it would really help me debug this.

Here's a link to the dll enabling logging. Just replace the one in your libation folder and try to download that troublesome book. https://github.com/Mbucari/AAXClean/raw/master/AaxDecrypter.dll

rmcrackan commented 3 years ago

You're safe to add it as Verbose level logging. I even added a popup that if you start Libation in Verbose mode that not logs will not be entirely anonymized

wtanksleyjr commented 3 years ago

Awesome, I'll get that as soon as possible (I'm away from the machine right now).

-Wm

On Sat, Jul 24, 2021 at 1:15 PM rmcrackan @.***> wrote:

You're safe to add it as Verbose level logging. I even added a popup that if you start Libation in Verbose mode that not logs will not be entirely anonymized

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-886106373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6LAL3SANF5TPQHSEGDTZMNPRANCNFSM5A3FRKJA .

wtanksleyjr commented 3 years ago

OK, so here's the problem: it doesn't download the book. There's nothing regarding that book in the temp folder. How can I get you the logs, though?

-Wm

On Sat, Jul 24, 2021 at 1:17 PM William Tanksley, Jr @.***> wrote:

Awesome, I'll get that as soon as possible (I'm away from the machine right now).

-Wm

On Sat, Jul 24, 2021 at 1:15 PM rmcrackan @.***> wrote:

You're safe to add it as Verbose level logging. I even added a popup that if you start Libation in Verbose mode that not logs will not be entirely anonymized

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-886106373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6LAL3SANF5TPQHSEGDTZMNPRANCNFSM5A3FRKJA .

Mbucari commented 3 years ago

OK, so here's the problem: it doesn't download the book. There's nothing regarding that book in the temp folder. How can I get you the logs, though?

Open the log file and look for "DownloadUrl". Open that link in your web browser to download the encrypted file. Put that file into dropbox or onedrive or something and email me a link, along with the log file.

-removed-

Alternatively, try downloading again, let it fail, then email me the log file. The DownloadUrl is good for 1 hour, so if you get me the log asap I can just download it on my end.

Mbucari commented 3 years ago

OK, so I had a better look at those logs and realized that [B002UZN3YI] The Fourth Turning: An American Prophecy is failing on the api.GetDownloadLicenseAsync call in DownloadDecryptBook with NullReferenceException. I'm assuming this means that GetApiAsync is returning a null Api, so I think that's a @rmcrackan issue if I may volunteer you lol.

The second book, [2291082140] 50 Self-Help Classics to Guide You to Financial Freedom, is failing in AAXClean. It's 5.1GB book and AAXClean only supports version 0 (32-bit) mpeg-4 files currently. I'm going to update it to support version 1 (64-bit) mpeg files.

rmcrackan commented 3 years ago

Sure I’ll take a look at the NRE. Log file?

Mbucari commented 3 years ago

Sure I’ll take a look at the NRE. Log file?

The one @wtanksleyjr linked above. Line 14.

rmcrackan commented 3 years ago

I'm stumped. I don't see how that's possible. For the line that throws the NRE, if any of those parts were null, the previous line would have failed, thus preventing us from reaching that line. If it failed inside GetDownloadLicenseAsync then the error stack would be longer.

Does that book always fail? or was that a one-off?

Mbucari commented 3 years ago

OK, AAXClean has been updated to support 64-it addresses. I don't think I broke anything in the process, but I'm sure someone will tell me if I did.

wtanksleyjr commented 3 years ago

It's always failed, since I started trying with Libation.

-Wm

On Sun, Jul 25, 2021 at 6:15 AM rmcrackan @.***> wrote:

I'm stumped. I don't see how that's possible. For the line that throws the NRE, if any of those parts were null, the previous line would have failed, thus preventing us from reaching that line. If it failed inside GetDownloadLicenseAsync then the error stack would be longer.

Does that book always fail? or was that a one-off?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-886200599, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6LQIDGBTWT2NQS72OLTZQE57ANCNFSM5A3FRKJA .

rmcrackan commented 3 years ago

Next release will have Mbucari's 64-bit decoder. It will also have added logging to help with the other book. You'll need to run Libation with log level debug or verbose to log it then reply here with the new log. New version will be out today or tomorrow.

rmcrackan commented 3 years ago

v5.3.8 is released. Hopefully it will yield helpful logs around that one mystery.

wtanksleyjr commented 3 years ago

Here's a logfile from trying to liberate both books. Looks like they both fail in different ways.

https://gist.github.com/wtanksleyjr/645b094b5ac752b7f10006f636e7658d

rmcrackan commented 3 years ago

@Mbucari I found the NRE but the underlying problem remains. contentLic is null . Back to you :)

aaxToM4bConverterDecryptAsync

var contentLic = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId);

rmcrackan commented 3 years ago

I pushed my code (AudibleApi and Libation repo.s) but have not yet created a release. I thought you'd want to look at that first

Mbucari commented 3 years ago

Re 50 Self-Help..., I have that book in my library and it works for me. I suspect you have a corrupted temporary file in %tmp%\Libation\DownloadsInProgress. Try deleting everything in there and in %tmp%\Libation\DecryptInProgress and try again.

For the other one, something is wrong with the license returned by the server. It could be that you're being denied a license. I've added some more logging in the api to try and detect it, but you'll need to wait for a new release.

rmcrackan commented 3 years ago

v5.3.9 has the new Verbose debug message in the license downloader:

https://github.com/rmcrackan/Libation/releases/latest

wtanksleyjr commented 3 years ago

Indeed, here we go:

2021-07-28 06:37:52.485 -07:00 [INF] (at LibationWinForms.BookLiberation.LogMe+<>c.<.ctor>b__9_0(System.Object, System.String)) Automated backup: Decrypt Step, Begin: [B002UZN3YI] The Fourth Turning: An American Prophecy
2021-07-28 06:37:52.590 -07:00 [INF] (at InternalUtilities.AudibleApiActions.GetApiAsync(System.String, System.String, AudibleApi.ILoginCallback)) GetApiAsync. {"Username":"w[...]r@g[...]l.c[...]m","LocaleName":"us"}
2021-07-28 06:37:53.527 -07:00 [VRB] (at AudibleApi.Api+<GetDownloadLicenseAsync>d__30.MoveNext()) Trying to debug mysterious null ref exception {"contentLicenseDtoV10":"{\"content_license\":{\"acr\":\"CR!5SR09K09ZX0XH4WNN19FBJAY31AQ\",\"asin\":\"B002UZN3YI\",\"content_metadata\":{\"chapter_info\":{\"brandIntroDurationMs\":1904,\"brandOutroDurationMs\":4969,\"chapters\":[{\"length_ms\":2751240,\"start_offset_ms\":0,\"start_offset_sec\":0,\"title\":\"Chapter 1\"},{\"length_ms\":2664072,\"start_offset_ms\":2751240,\"start_offset_sec\":2751,\"title\":\"Chapter 2\"},{\"length_ms\":2775899,\"start_offset_ms\":5415312,\"start_offset_sec\":5415,\"title\":\"Chapter 3\"},{\"length_ms\":2706750,\"start_offset_ms\":8191211,\"start_offset_sec\":8191,\"title\":\"Chapter 4\"},{\"length_ms\":2736100,\"start_offset_ms\":10897961,\"start_offset_sec\":10898,\"title\":\"Chapter 5\"},{\"length_ms\":2684923,\"start_offset_ms\":13634061,\"start_offset_sec\":13634,\"title\":\"Chapter 6\"},{\"length_ms\":2765636,\"start_offset_ms\":16318984,\"start_offset_sec\":16319,\"title\":\"Chapter 7\"},{\"length_ms\":2632353,\"start_offset_ms\":19084620,\"start_offset_sec\":19085,\"title\":\"Chapter 8\"}],\"is_accurate\":true,\"runtime_length_ms\":21716973,\"runtime_length_sec\":21717},\"content_reference\":{\"acr\":\"CR!5SR09K09ZX0XH4WNN19FBJAY31AQ\",\"asin\":\"B002UZN3YI\",\"content_format\":\"AAX_22_64\",\"content_size_in_bytes\":175626740,\"file_version\":\"2\",\"marketplace\":\"AF2M0KC94RCEA\",\"sku\":\"BK_BANT_000419\",\"tempo\":\"1.0\",\"version\":\"2\"},\"last_position_heard\":{\"status\":\"DoesNotExist\"}},\"drm_type\":\"Adrm\",\"license_denial_reasons\":[{\"message\":\"Asin [B002UZN3YI] is not eligible for AYCL\",\"rejectionReason\":\"ContentEligibility\",\"validationType\":\"AYCL\"},{\"message\":\"Ownership: User [A1O2WKOOUNQRWZ] does not has Ownership rights for asin [B002UZN3YI].\",\"rejectionReason\":\"RequesterEligibility\",\"validationType\":\"Ownership\"},{\"message\":\"Since ClientId is null, skipping client rights validation.AAAClientId[ApolloEnv:AudibleApiExternalRouterService/NA/ACLS/Prod], does not has access to asin[B002UZN3YI].\",\"rejectionReason\":\"RequesterEligibility\",\"validationType\":\"Client\"},{\"message\":\"Customer [A1O2WKOOUNQRWZ] is not part of any plans.\",\"rejectionReason\":\"RequesterEligibility\",\"validationType\":\"Membership\"}],\"message\":\"License not granted to customer [A1O2WKOOUNQRWZ] for asin [B002UZN3YI]\",\"request_id\":\"a7c9ff4c-1069-486e-8a6e-3c9dd61d4f97_70QZV5NM159YXY21Y9DD\",\"requires_ad_supported_playback\":false,\"status_code\":\"Denied\"},\"response_groups\":[\"always-returned\",\"last_position_heard\",\"pdf_url\",\"chapter_info\",\"content_reference\"]}"}
rmcrackan commented 3 years ago

does not has access to asin[B002UZN3YI]

Well that can't be good

wtanksleyjr commented 3 years ago

Would it be possible to increase the timeout for scanning the library? I've got an account with 1500 books, and it's right at the boundary of not being able to fit into the timeout. Last 5 scans have all failed, but usually if I just retry it eventually works.

wtanksleyjr commented 3 years ago

Here's a probably relevant detail: this book ("The Fourth Turning") might actually belong to my brother, shared with me through household sharing (he's in the same amazon household as me) -- he's got about 100 books of his own, all of which download through Libation except this one.

rmcrackan commented 3 years ago

Would it be possible to increase the timeout for scanning the library?

It's currently doing batches of 300. I'll go down a bit and see if that helps.

household sharing

My wife and I do this too and I can get all from her account fine. However, the following happened to me once:

I purchased a lot of books one day in separate transactions. One of them failed. I retried and bought that one too. Libation processed all just fine. My wife could see all but 1 on her phone. I contacted customer service and they 're added' the book to my account. After that, she could see it.

In my case though, she couldn't originally see it at all which is different than your issue. Might be worth trying to contact cust. service though.

Mbucari commented 3 years ago

he's got about 100 books of his own, all of which download through Libation except this one.

I don't understand. Are you saying he has 100 books in his library that he is able to download using Libation with his account, but he is also unable to download this title?

wtanksleyjr commented 3 years ago

No, I mean that because of household sharing, I can download all of his books through my account, except this one.

So we've found some kind of bizarre corner case.

-Wm

On Wed, Jul 28, 2021 at 8:11 AM Mbucari @.***> wrote:

he's got about 100 books of his own, all of which download through Libation except this one. I don't understand. Are you saying he has 100 books in his library that he is able to download using Libation with his account, but he is also unable to download this title?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-888390743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6PRXZWRXAYIR44YCNDT2AMYHANCNFSM5A3FRKJA .

Mbucari commented 3 years ago

But you were able to download the 50 Self Help books?

wtanksleyjr commented 3 years ago

Oh, right, yes! All 5.1 gigabytes of it. And that's my brother's too.

rmcrackan commented 3 years ago

Can your brother ask customer service to re-add the problem book?

Mbucari commented 3 years ago

Were you able to download The Fourth Turning with Libation 4.x?

wtanksleyjr commented 3 years ago

Were you able to download The Fourth Turning with Libation 4.x?

No, I posted the log in my comment beginning with "Indeed, here we go".

Mbucari commented 3 years ago

No, I posted the log in my comment beginning with "Indeed, here we go".

Yeah, I saw that log. But starting in Libation 5.0 it uses the "api.audible.com/1.0/content/{asin}/licenserequest" api to get aaxc licenses and files. Prior to that it used the "cde-ta-g7g.amazon.com/FionaCDEServiceEngine/FSDownloadContent" endpoint to get aax files. The "validationType":"Client" message made me think it's possible it would work with the pre-5.0 method, but it's just a hunch.

Mbucari commented 3 years ago

Are you or your brother able to use the Windows 10 Audible app to listen to that title?

wtanksleyjr commented 3 years ago

Oh, THAT is a useful check and explains much.

Sure enough, it cannot be downloaded through the Audible Windows App; it works from the website. (It also doesn't work from Android.)

I see what you meant by Libation 4. I don't remember at all, but probably I didn't try.

Clearly this is enough for me to talk to Audible Customer Support. (You'll understand, I hope, why I didn't want to say "I'm trying to debug an app that allows users to manage their own Audible books." We're legal, but that doesn't mean we want to make ourselves too obvious.)

-Wm

On Wed, Jul 28, 2021 at 9:08 AM Mbucari @.***> wrote:

Are you or your brother able to use the Windows 10 Audible app to listen to that title?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-888434749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6MFO6LQQYO7TZUQQXTT2ATQRANCNFSM5A3FRKJA .

wtanksleyjr commented 3 years ago

Ha ha OK, so problem solved -- he returned the book, and Audible just left a husk of it in my account somehow.

So I'll just have them remove it, and problem solved.

-Wm

On Wed, Jul 28, 2021 at 4:32 PM William Tanksley, Jr @.***> wrote:

Oh, THAT is a useful check and explains much.

Sure enough, it cannot be downloaded through the Audible Windows App; it works from the website. (It also doesn't work from Android.)

I see what you meant by Libation 4. I don't remember at all, but probably I didn't try.

Clearly this is enough for me to talk to Audible Customer Support. (You'll understand, I hope, why I didn't want to say "I'm trying to debug an app that allows users to manage their own Audible books." We're legal, but that doesn't mean we want to make ourselves too obvious.)

-Wm

On Wed, Jul 28, 2021 at 9:08 AM Mbucari @.***> wrote:

Are you or your brother able to use the Windows 10 Audible app to listen to that title?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-888434749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6MFO6LQQYO7TZUQQXTT2ATQRANCNFSM5A3FRKJA .

Mbucari commented 3 years ago

Great news! So as of right now we are not aware of any titles not working. That's a good place to be!

rmcrackan commented 3 years ago

Woohoo!!!

wtanksleyjr commented 3 years ago

Congrats to both of you, what an impressive accomplishment!

This is right now the best app of its kind, and it's SIMPLE to work with.

-Wm

On Wed, Jul 28, 2021 at 5:16 PM Mbucari @.***> wrote:

Great news! So as of right now we are not aware of any titles not working. That's a good place to be!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmcrackan/Libation/issues/68#issuecomment-888703242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ7H6P6YW5Y6AABEL7ZMBDT2CMV3ANCNFSM5A3FRKJA .

rmcrackan commented 3 years ago

Thanks to you also. This was a monster of a debug session