Woody2143 / HumbleBundleDL

Script used to download files from Humble Bundle
MIT License
5 stars 2 forks source link

Binary Mode must be set for Windows machines #4

Open tboehnlein opened 6 years ago

tboehnlein commented 6 years ago

I'm trying to get your code to work on Windows. One thing I figured out is it is necessary to call binmode SAVE; before closing it near the end of the script or the file will not be able to be opened properly in Windows.

Woody2143 commented 6 years ago

I'll take a look at that. I've thought about messing with the code on windows to see how it would (or wouldn't) work; just hadn't gotten to it yet.

Woody2143 commented 6 years ago

I have "binmode(STDOUT, ":utf8");" near the top of the script. Running it via Cygwin seems to work, the files save and can be opened fine. I'll have to try out Strawberry Perl and see if it works the same.

Woody2143 commented 6 years ago

The script seems to work equally as well under Strawberry Perl. If you pull down the lastest copy of the script (I did some rebaseing cause of issues, sorry) it /should/ work. Let me know if not.

tboehnlein commented 6 years ago

I switched over to Strawberry Perl from Active Perl so we are both using the same one. There's actually another issue I need to solve first. I cannot get my _simpleauth_sess key to work. I've tried grabbing the cookie value from Firefox, Chrome and Edge. All of them give me an HTTP file from the UserAgent instead of the JSON. I've been getting around it by just downloading the JSON file myself and reading that in directly into the JSON reader. Any idea why my key isn't working? I'd rather try to get this working than keep modding your script to read in the saved JSON file. New code looks great. Hope I can get it to work.

Woody2143 commented 6 years ago

I ran in to an issue before with the cookie where some special characters weren't copied over correctly.

When using Chrome do the following:

  1. Goto: chrome://settings/siteData
  2. Type "humble" in to the search box
  3. Select "www.humblebundle.com"
  4. Select "_simpleauth_sess"
  5. Copy the content of that cookie.
  6. Make sure it pastes EXACTLY that in to the cfg file.

If I remember correctly I think it was characters like the '\07'.

Hope that helps, sorry you are having the trouble with it.

Woody2143 commented 6 years ago

I just tried it from Chrome in windows and it appears to be working.

In chrome this path may be quicker: chrome://settings/cookies/detail?site=www.humblebundle.com&search=cookie

Depends on the version of Chrome you have. But I copied the cookie value, pasted it in to the cfg file (without the double quotes, using just single quotes) and it pulled down the bundles for me.

Hope this helps.

tboehnlein commented 6 years ago

Boom! Putting single quotes around the key instead of double quotes fixed it. Thank you so much! So I wrote some code that instead of you waiting for your bundles to be processed with no response, it gives you a progress percentage much like the file download progress. Is that something I can merge back into your code? I'm also working on code for a file type preference order. So I can specify give me .cbz files for a book item, but if it doesn't have .cbz, give me the .epub file and if it doesn't have .epub then grab the pdf file else grab the .mobi file. This way I don't download everything. The .cbz files alone take up 100GB of space on my drive. It works really well. I just haven't added a way for the user to specify it yet. For now the preference is hard coded into a list in the script. Maybe it could go into the config file since it isn't likely to change.

tboehnlein commented 6 years ago

Also, your script is awesome. This is really the only way I can get all of the items I purchased. Doing it by hand would be next to impossible.

Woody2143 commented 6 years ago

That’s great! I’d be glad to have any and all code you would like to submit. :)

-- Brandon Wood

On Apr 7, 2018, at 17:05, Stocklone notifications@github.com wrote:

Boom! Putting single quotes around the key instead of double quotes fixed it. Thank you so much! So I wrote some code that instead of you waiting for your bundles to be processed with no response, it gives you a progress percentage much like the file download progress. Is that something I can merge back into your code? I'm also working on code for a file type preference order. So I can specify give me .cbz files for a book item, but if it doesn't have .cbz, give me the .epub file and if it doesn't have .epub then grab the pdf file else grab the .mobi file. This way I don't download everything. The .cbz files alone take up 100GB of space on my drive. It works really well. I just haven't added a way for the user to specify it yet. For now the preference is hard coded into a list in the script. Maybe it could go into the config file since it isn't likely to change.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Woody2143 commented 6 years ago

Thanks! I am happy it’s getting some use and attention. And yeah I had a ton of books and comics to download so I was glad to start in on it. :)

-- Brandon Wood

On Apr 7, 2018, at 17:08, Stocklone notifications@github.com wrote:

Also, your script is awesome. This is really the only way I can get all of the items I purchased. Doing it by hand would be next to impossible.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Woody2143 commented 6 years ago

Oh. I messed up with git the other day trying to fix some history. You may want to pull down a fresh copy and put your changes there. Not a big deal if you don’t, may just be easier in the long run.

-- Brandon Wood

On Apr 7, 2018, at 17:08, Stocklone notifications@github.com wrote:

Also, your script is awesome. This is really the only way I can get all of the items I purchased. Doing it by hand would be next to impossible.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.