TheAxeDude / ZiniGo

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

AccessToken missing from LoginResponse #2

Closed piccombs closed 3 years ago

piccombs commented 4 years ago

Nifty bit of code that I want to see work, but unless I'm missing something, they've changed the login response since you've last updated. The nature of API's I guess :/

I've been tinkering with your source and in the login response I'm seeing a data structure like this:

{"data":{"user":{"allow_adult_content":true,"default_currency_code":"USD","default_locale_code":"en_US","default_newsstand_id":101,"country_code":"US","first_name":null,"email":"example@email.com","user_id_string":"2357563771234567891","user_external_id":"id_example@email.com1234567891"}},"status":true}

Subsequent requests throw 401 errors because the access_token is missing in the json response of the login request. Not sure where to go from there.

TheAxeDude commented 4 years ago

Thanks for letting me know! I've taken a quick look and it definitely appears the response (and a few other things) have changed.

I will work through these and push a new version soon.

TheAxeDude commented 3 years ago

Hi,

Please can you try the version on the feature/testing-api-changes branch? Windows executable is here: https://github.com/TheAxeDude/ZiniGo/tree/feature/testing-api-changes/built

If you need Linux, please let me know, I dont have access to a linux env at the moment to test it, so didnt push the artifact.

Vinnie20201 commented 3 years ago

I have a feeling I may doing something wrong because I keep getting "executable file not found in %PATH%". Any idea what I could do? I keep pasting where to find Chrome.exe in filed explorer in -c.

TheAxeDude commented 3 years ago

Can you paste the whole command you're running? Feel free to remove any identifying info (usernames, passwords etc)

Vinnie20201 commented 3 years ago

C:\Users\namec>C:\Users\name\Desktop\Zinigo_Windows_x64.exe -u=Username -p=Password [-c="Program Files (x86)Google\Chrome\Application\Chrome.exe"] This gives me the error "cmd.Run() failed with exec: "google-chrome": executable file not found in %PATH%"

When I remove the brackets like so, C:\Users\namec>C:\Users\name\Desktop\Zinigo_Windows_x64.exe -u=Username -p=Password -c="Program Files (x86)Google\Chrome\Application\Chrome.exe" I get the error "cmd.Run() failed with exec: "Program Files (x86)\Google\Chrome\Application\Chrome.exe": file does not exist"

Sorry, I am not use to the cmd prompt.

EDIT: It looks like its working though. If I copy the .svg link, it takes me to a page in the pdf. EDIT 2: Ok so I got it to work with this line right here, C:\Users\user>C:\Users\user\Desktop\Zinigo_Windows_x64.exe -u=Username -p=Password -c="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" But the problem is now its saving the pdfs as blank documents. It gets the name and date correct but everything in the pdf is blank with a page count of 1/1.

TheAxeDude commented 3 years ago

That's great news! I think you just need to drop template.html (https://github.com/TheAxeDude/ZiniGo/blob/master/template.html) in the same folder as the executable.

Vinnie20201 commented 3 years ago

I dropped the template.html file in a folder that also contains the Zinigo_Windows_x64 application and it provides the same results (blank pdf with a page count of 1/1) EDIT: I tried opening the pdfs in different pdf viewers and all the same results.

TheAxeDude commented 3 years ago

Thats strange, can you paste the logs from the app?

TheAxeDude commented 3 years ago

Thanks for that. I just tested on my side, and i replicated the issue when I removed the template.html. Can you confirm that template.html is in the same folder, and isnt empty?

I will look at pushing a version with the default template built in.

Also, feel free to remove the majority of your comment - there might be some personal info you missed in the logs.

Vinnie20201 commented 3 years ago

This is the folder, it is on my desktop and those are the contents of the template.html document.

Untitled

The issues folder is being pasted here C:\Users\user\issue

Also, thank you for your help and thank you for building this application.

TheAxeDude commented 3 years ago

Thats so strange. I've just pushed a new version to the feature branch - it will use a default html template string. Can you try it out for me?

Vinnie20201 commented 3 years ago

ok so the cmd shows this

C:\Users\user>C:\Users\user\Desktop\zinigo\Zinigo_Windows_x64.exe -u=username -p=password -c="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" Starting the application... Found 10 issues in library. Loading HTML template template.html not found, or empty. using built in template. Consider changing this if your files are cropped.

Like the cmd said, no blank pages, but all the pdfs were cropped.

TheAxeDude commented 3 years ago

That sounds better!

Can you make another folder (not on your desktop), like in c:/zinigo/ ? I suspect windows is doing something weird with the paths. Put the executable and the template html in there and run from there in the CMD window.

Edit: this won't change the output, but it'll let us change the template html file, and tailor it to your magazine.

Vinnie20201 commented 3 years ago

Zinigo is now located in C:\zinigo and the template HTML document is in there with it. I ran Zinigo exe in CMD and I got the same results.

TheAxeDude commented 3 years ago

Hmm. And does the log still say that it couldn't find the template html file?

I'll need to add some extra logging so we can dig into it.

Vinnie20201 commented 3 years ago

Yeah I am getting this still

Starting the application... Found 10 issues in library. Loading HTML template template.html not found, or empty. using built in template. Consider changing this if your files are cropped.

Is there a way I am supposed to download the html file? I am finding it under ZiniGo/built/template.html then I click raw and save as.

TheAxeDude commented 3 years ago

100% correct. I'll add a new version with tracing so we can try figure out what's going on.

Vinnie20201 commented 3 years ago

Ok keep me updated, thank you for all your help.

TheAxeDude commented 3 years ago

I have a new theory as to whats happening.

Can you please try the newest version from https://github.com/TheAxeDude/ZiniGo/tree/feature/testing-api-changes/built

I dont think it'll work, but it should print a message with "Resolved working directory to: xxx". Can you see if xxx matches where the program is stored?

Vinnie20201 commented 3 years ago

You are correct. The CDM printed out this message.

Starting the application... Found 10 issues in library. Loading HTML template template.html not found, or empty. using built in template. Consider changing this if your files are cropped. Resolved working directory to: C:\Users\user

TheAxeDude commented 3 years ago

Okay cool, in your command window, type:

cd c:\Users\path\to\exe\folder

The 'cd' command means 'change directory'. Then please retry? It should then pickup the template.html....

Once thats done, you'll need to tweak the template.html to work for the dimensions of the magazine you're trying to download.

Vinnie20201 commented 3 years ago

Good news, it seems like it working now!

TheAxeDude commented 3 years ago

Awesome :) I'm going to go ahead close this issue. Please open another if you have more issues. Enjoy your reading!