Skip to content

An automated utility to download your Humble Bundle purchases with support for the Authy token.

License

Notifications You must be signed in to change notification settings

MKindy/hb-downloader

 
 

Repository files navigation

hb-downloader

Coverage Status Build Status

An automated utility to download your Humble Bundle purchases.

http://www.humblebundle.com

This package is not endorsed, supported, or affiliated with Humble Bundle, Inc.

This package is distributed under the MIT license. You may use, modify, and redistribute it freely provided you agree with the terms of the license, found in the accompanying LICENSE file or online at https://opensource.org/licenses/MIT.

This repository is a fork with additional functionality and fixes of the software originally distributed by Brian Schkerke and available at https://github.com/talonius/hb-downloader.

This repository contains code from Joel Pedraza's awesome humblebundle-python library, available at https://github.com/saik0/humblebundle-python.

Requirements

  • Python 3.6
  • requests library
  • pyyaml library
  • lxml (optional, for Humble Trove support)

Python Installation

Several features particular to Python v3.6 might have been used during the development of this script. To install Python v3.6 visit https://www.python.org/downloads/ and grab the latest 3.x.x release.

Getting the Prerequisites

From the command line, run the command:

pip install requests pyyaml lxml

You'll either be informed that the requirement is already satisfied, or pip will retrieve, install, and configure the libraries for you.

Alternatively, you can run the setup.py script.

Getting the Script Files

Perform one of the following actions:

  • Download the latest code from the master branch as a zip file; or
  • Check out the source with Git: git clone https://github.com/MKindy/hb-downloader.git

Configuring the Script

hb-downloader-settings.yaml is the configuration file for the script. It contains all of the information that can be overridden during script execution trough the command line interface. The format is:

<variable name>: <variable value>

Or:

<variable group>:
  <variable name>: <variable value>

The first thing you will need is to fetch your authentication cookie from humblebundle.com. To do so, open https://www.humblebundle.com/, log in, and once logged in press F12 to open your browser's developer tools:

  • In Firefox's Developer Tools, select the "Storage" tab and there look for the "Cookies" drop-down menu;
  • In Chrome's Developer Tools, select the "Application" tab and there look for the "Cookies" drop-down menu under the "Storage" menu;
    • Safari, Opera, Vivaldi, Brave, and Edge will have similar layouts to Chrome;
    • Safari's developer tools must be separately enabled, as explained in the online Safari User Guide;
  • In Internet Explorer, navigate to your preference of either https://mozilla.org/firefox/ or https://google.com/chrome/, install your new chosen browser, and then follow the steps above;
  • In any of a number of alternative browser engines, you're on your own, but you'll probably figure it out fine, since you're the kind of enthusiast who's using a browser with essentially no market share;

Select the cookie for https://www.humblebundle.com and look for the variable named _simple_auth. Its value will be 144 characters long, split up as shown below; copy its value and paste it within single quotes in the session-cookie setting of the hb-downloader-settings.yaml file; it should ultimately look like:

session-cookie: '<92-digit mixed-case alphanumeric>|<10-digit number>|<40-digit hex number>'

You may alternatively choose to specify this cookie on the command line with the -c flag, being sure to escape the | character accordingly.

The second thing you will need is to tell the script where you want to store the files. download-location is that location; it can be a Linux-style or Windows-style directory, or a shared folder via a UNC path. It must already exist; the script will not create the directory for you:

# Linux-style:
download-location: /mnt/mark/Downloads/Humble/

# Windows-style:
download-location: Z:\mark\Downloads\Humble\

# UNC path:
download-location: \\192.168.0.2\mark\Downloads\Humble\

The rest of hb-downloader-settings.yaml, as configured, will tell the script to download every file in your Humble library. You may make further modifications to the max-file-size setting or to any or all of the download-platforms, audio_types, ebook_types, and/or file-extensions variable group settings to limit what gets downloaded.

It is unlikely you will need to make changes to any of the other undiscussed settings.

Issues

If you encounter any issues or have suggestions, please open a new issue on GitHub.

Known Issues

If you run the script in a Windows terminal or PowerShell session, you may encounter this error:

UnicodeEncodeError: 'charmap' codec can't encode character...

This only happens if you have an extended character in the name of one of your products. The easiest fix is to export an environment variable so that Python knows the terminal can accept Unicode; in your Windows terminal or PowerShell session, run:

# "set" defines the environment variable immediately, without persistence
set PYTHONIOENCODING=UTF-8
# "setx" permanently defines the environment variable, but requires restart
#    without "set" above:
setx PYTHONIOENCODING=UTF-8

Usage examples

# Both of these will just download all the stuff according to your config files:
hb-downloader.py
hb-downloader.py download

# Lists all your products (the bundles) and subproducts (the individual titles):
hb-downloader.py list

# Will download a single bundle either from email link or game-key:
hb-downloader.py download-product <bundle url>
hb-downloader.py download-product <product key>

About

An automated utility to download your Humble Bundle purchases with support for the Authy token.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 100.0%