mmarcincin / HB-DRM-free-bulk-downloader

powershell script for downloading humble bundle DRM-Free files
98 stars 14 forks source link

HB DRM-Free bulk downloader

Download link: https://github.com/mmarcincin/HB-DRM-free-bulk-downloader/archive/master.zip

It's a powershell script which allows you to download DRM-Free content (e-books, games, music, etc) from Humble Bundle pages (https://www.humblebundle.com/downloads?key=XXXXXXXXXXXXXXXX) in bulk.

To install newer Powershell on Windows 7, visit this link: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell?view=powershell-6


HB DRM-Free bulk downloader 0.4.3

Bundle files are downloaded sequentially and saved in folder structure as shown in this example: downloads\bundleName\bookName\specificBookFile.extension

latest additions:

0.4.0 additions:

All switches below modify the behaviour until modified again. Both switches and links are entered in the links.txt file which will open once you launch RUN.bat. If you want to make shortcut for the script, create shortcut for the RUN.bat.

Example of links.txt:

^_simpleauth_sess cookie
#pdf
https://www.humblebundle.com/downloads?key=XXXXXXXXXXXXXXXX

_simpleauth_sess cookie

a) developer console option

  1. navigate to humblebundle.com in your browser, open developer console using shift+i/shift+c
  2. at the top you can see tabs like Elements, Console, ... open application tab (if not visible click on >>)
  3. select cookies and then humblebundle.com, filter cookies by '_simpleauth_sess'
  4. click on it and copy Cookie Value shown below into links.txt (best entered as first line) in format: ^text

b) browser settings option

  1. a) easy steps - Copy this link into browser:

    • For Opera: opera://settings/cookies/detail?site=humblebundle.com
    • For Google Chrome: chrome://settings/cookies/detail?site=humblebundle.com
  2. b) detailed steps

    • open settings in your browser, for Opera go to Settings (alt+p), for Google Chrome click on 3 vertical dots in top right corner > go to Settings
    • for Opera and Google Chrome: Enter 'cookies' into search settings field > Cookies and other site data > See all cookies and site data. > Enter 'humblebundle' into Search cookies field, choose humblebundle.com
  3. Find '_simpleauth_sess' cookie and copy the cookie text in field Content into links.txt (best entered as first line) in format: ^text

You can have multiple '_simpleauth_sess' cookie text strings (if you need to download the DRM-Free files from some other humble bundle account) in your links.txt file.

comments in links.txt

Any line which doesn't start with switch character like ~,!,@,#,$,%,^,* or https://www.humblebundle.com/downloads?key= is ignored/treated like comment line. Because of that you can for example put titles of bundles in links.txt like this:

^_simpleauth_sess cookie
#pdf
Humble Book Bundle: Programming Cookbooks by O'Reilly
https://www.humblebundle.com/downloads?key=XXXXXXXXXXXXXXXX

Switches

To specify your preferred label/extension/format for link only, use:

for global preferred label use:

platform/section global switches:

md5 global switches:

log files:

preference global switches:

Switches #,%,!,~ support multiple parameters in one line:

direct download switches:

path length switches:

255+ file paths issues

If you still have troubles with long file paths, considering moving downloader up in the folder structure or try using subst for your folder.

Downloads are permanently stored after each book/download versions are retrieved. If you interrupt it then your partially downloaded book/download will be removed. Next time you start this script, it'll continue where you left (the next book/download) if you kept the downloaded books/downloads in downloads folder.

To better track the download progress without minimizing your active window, you can go to Taskbar settings: Combine Taskbar buttons > 'When Taskbar is full'. Then you'll be able to see the download progress shown in the window title on your taskbar.

Powershell ExecutionPolicy change

start RUN.bat to launch the script for editing the script itself open HB-DRM-Free_download.ps1 in notepad (or notepad++, etc...)

If the window closes fast after starting RUN.bat, follow these steps:

  1. Go to any folder (file explorer) and choose file > open windows powershell > open windows powershell as administrator.
  2. In the Windows PowerShell window type: get-ExecutionPolicy.
  3. If you are geting the 'Restricted' text, type: set-ExecutionPolicy RemoteSigned, then just confirm with y for yes.
  4. After that the RUN.bat should work as intented.

If you'd like to create a shortcut for the script, you just need to make shortcut of RUN.bat file.

Possible Errors - unremovable folder with leading/trailing space

There were bundles which had space at the end of their name, before version 0.3.5 it didn't remove those spaces which could cause problems mentioned below.

If my script created folder with space (" ") in name and you can't remove it now, you could try this to fix it: quote by JustSolvedIt from https://superuser.com/questions/565334/rename-delete-windows-x64-folder-with-leading-and-trailing-space/911994#911994

I just had a similar problem with folder "Monuments - Discography " created in linux. Windows Vista and Windows 7 couldn't recognize this folder as a valid data and when I tried to rename or remove it I got Info message saying that folder does not exist etc. The solution was to explore a dir with 7zip file manager and rename the folder by removing a white space from the end. Simple. Now I can enjoy the music once again :D