ZiniGo icon indicating copy to clipboard operation
ZiniGo copied to clipboard

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

Open xfclele opened this issue 1 year ago • 17 comments

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 [email protected] -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.

xfclele avatar Nov 01 '23 03:11 xfclele

I have the same problem on MacOS.

jmskuo avatar Nov 08 '23 03:11 jmskuo

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"}}

saritonin avatar Nov 22 '23 02:11 saritonin

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 avatar Jan 30 '24 19:01 motoyugota

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 avatar Jan 31 '24 03:01 motoyugota

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

RupertB-ES avatar Jan 31 '24 08:01 RupertB-ES

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

motoyugota avatar Jan 31 '24 15:01 motoyugota

Can you post the fixed files individually rather than the zip

RupertB-ES avatar Jan 31 '24 15:01 RupertB-ES

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

motoyugota avatar Jan 31 '24 16:01 motoyugota

@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.

TheAxeDude avatar Jan 31 '24 16:01 TheAxeDude

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

motoyugota avatar Jan 31 '24 16:01 motoyugota

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.

motoyugota avatar Jan 31 '24 16:01 motoyugota

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/[email protected]/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/[email protected]/pkg/api/merge.go:128 +0x41d main.main() C:/Users/charl/source/repos/ZiniGo/Zinigo/main.go:186 +0x12cc

RupertB-ES avatar Feb 02 '24 15:02 RupertB-ES

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.

motoyugota avatar Feb 02 '24 15:02 motoyugota

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

RupertB-ES avatar Feb 02 '24 16:02 RupertB-ES

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!!

jayHuggie avatar Feb 19 '24 08:02 jayHuggie

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?

noahkrueger avatar Mar 31 '24 15:03 noahkrueger

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 ... 💀

BreakWooden avatar Apr 10 '24 18:04 BreakWooden