TheAxeDude / ZiniGo

Utility to backup magazines from the Zinio service as PDF, bypassing/Removing their DRM.
MIT License
49 stars 9 forks source link

Error when trying to download magazines: "index out of range" #39

Open xfclele opened 11 months ago

xfclele commented 11 months ago

Description: I encountered an error while attempting to download magazines I purchased using ZiniGo. When I run the executable with my credentials, the program crashes with a "panic: runtime error: index out of range [2] with length 0" message.

Steps to Reproduce:

Downloaded the Windows x64 version of ZiniGo. Ran the program using the command: Zinigo_Windows_x64.exe -u=myemail@example.com -p=mypassword (Note: These aren't my real credentials). Observed the error shortly after the program started. Expected Behavior: I anticipated the program would download my magazines without errors.

Actual Behavior: The program crashed with a message:

panic: runtime error: index out of range [2] with length 0 goroutine 1 [running]: main.GetInitialToken(0x8f9060, 0xc000006018, 0xc000077650, 0x1) C:/projects/ZiniGo/Grabazine.go:215 +0x267 main.main()

Environment:

Operating System: Windows 11 64-bit (ARM-based processor) ZiniGo Version: 1.3 Browser: Chrome Version 120.0.6090.0 Additional Information: I have Chrome installed, and I made sure the path was correct. Not sure if it's related, but wanted to include this information.

jmskuo commented 11 months ago

I have the same problem on MacOS.

saritonin commented 11 months ago

I've done some digging and thus far have concluded that the issue is in the GetPages function - it's not returning good pages. The response from the HTTP call is below. I assume this means some sort of error with the Zinio API call, but don't know enough about the API to troubleshoot it.

{"status":false,"error":{"message":"Route not found in ApiRouter","internal_code":"CONTENT_ERROR"}}

motoyugota commented 8 months ago

It looks like they changed their API URL, as well as the actual response (based on the existing code). I had to play around with downloading on the zinio web page to find the new API URL and then I had to learn enough Go to figure out how to compile and run in VS Code to test, but I've made code changes that fix the issue. I will look at pushing out a pull request for this.

motoyugota commented 8 months ago

I don't have access to push code to the repo, so we'll see if the owner comes on and can grant it to me. In the meantime, I'm attaching the update file and executable if you want to try it. Fix.zip

RupertB-ES commented 8 months ago

Windows reports a virus detected in the Fix.zip you posted

motoyugota commented 8 months ago

No, it most certainly does not. Your computer probably doesn't understand what it is seeing because it is an unknown source.

RupertB-ES commented 8 months ago

Can you post the fixed files individually rather than the zip

motoyugota commented 8 months ago

No, GitHub doesn't allow either file type as an upload.

TheAxeDude commented 8 months ago

@motoyugota if you raise a pull request I'll try get it merged in. Sorry, I havent had much time recently to be able to take a look at this project.

motoyugota commented 8 months ago

@TheAxeDude I will see what I can do to do that.

motoyugota commented 8 months ago

Just put the pull request up there. Wasn't sure how you handled the build executables, so didn't include those, but can if you just want me to build them.

RupertB-ES commented 8 months ago

Did you change the contents of fix.zip - I tried to download it on a different machine and it was fine Ran it and all seemed will for about 20 mag issues and then I got Checking if issue exists: D:\RDEBKits\PDFs\zinigo\issue\Darkside Magazine - Issue Eight.pdf Downloading issue: Darkside Magazine - Issue Eight panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]: github.com/pdfcpu/pdfcpu/pkg/api.Merge({0x14ed480?, 0x0, 0x0}, {0x121dd60, 0xc000210458}, 0x1157cc0?) C:/Users/charl/go/pkg/mod/github.com/pdfcpu/pdfcpu@v0.3.13/pkg/api/merge.go:59 +0x2b4 github.com/pdfcpu/pdfcpu/pkg/api.MergeCreateFile({0x0?, 0x0, 0x0?}, {0xc009c6a000, 0x41}, 0xc00017e186?) C:/Users/charl/go/pkg/mod/github.com/pdfcpu/pdfcpu@v0.3.13/pkg/api/merge.go:128 +0x41d main.main() C:/Users/charl/source/repos/ZiniGo/Zinigo/main.go:186 +0x12cc

motoyugota commented 8 months ago

No, I didn't change anything. Like I said, the problem was your computer.

As for the new error, that is likely an issue with the underlying PDF in Zinio. I ran into several issues with various magazines I tried to download. There are some PDF version/capabilities issues with the library this uses to manipulate the PDFs. Since I don't actually know that library, I don't know if there's any way to get past that.

One thing this code could do, since it's past the point of decrypting the files when it gets there, is it could leave the single page PDFs on your computer instead of deleting them - that way you could merge them yourself with one of the various free online PDF merging tools.

RupertB-ES commented 8 months ago

Weird both machines I downloaded on were pretty much identical Win 11 pro builds alothough one was an I7 Surface Pro and the other a NUC A -Keep option would be a useful thing

jayHuggie commented 8 months ago

I don't have access to push code to the repo, so we'll see if the owner comes on and can grant it to me. In the meantime, I'm attaching the update file and executable if you want to try it. Fix.zip

@motoyugota I first got the "index out of range" error, but your file fixed it! (using Windows 11 64-bit) Thank you!!

noahkrueger commented 6 months ago

I tried the fix and am getting further, but it seems to be dying on the first page

GotLogin Fetching Library Fetching page:1 {"status":false,"error":{"message":"Route not found in ApiRouter","internal_code":"CONTENT_ERROR"}} Terminating the application...

Any ideas?

BreakWooden commented 6 months ago

I tried the fix and am getting further, but it seems to be dying on the first page

GotLogin Fetching Library Fetching page:1 {"status":false,"error":{"message":"Route not found in ApiRouter","internal_code":"CONTENT_ERROR"}} Terminating the application...

Any ideas?

I have the same problem with and without the fix file ... 💀