- Python 63.2%
- HTML 27.7%
- JavaScript 9.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| cookies.py | ||
| data.sample.py | ||
| LICENSE | ||
| main.js | ||
| main.py | ||
| models.py | ||
| pdm.lock | ||
| pyproject.toml | ||
| README.md | ||
| template.html | ||
| utils.py | ||
Bhumbledler
A set of Python scripts to collect Humble bundle stats about bought games, share a list of unused keys, and ease the process of claiming them.
It outputs a single HTML file holding a "ready-to-use" list, which can be sent to a website hoster along with the provided JavaScript at main.js.
Installation
As described in the pyproject.toml file, this project requires Python 3.12 or above.
pdm (backend version) is used for dependency management.
To install dependencies in a virtual environment, run:
pdm install
$(pdm venv activate)
The last command will activate the matching venv, so that tools like Scrapy can be used from the virtual environment.
Usage
Prerequisites
Several constants must be changed across the project:
cookies_secret.py: Replace theSESSION_TOKENvariable content with your actual session token when you visit Humble Bundle's website.data.py: As shown in the sample file, you may specify some already claimed keys in theRESERVED_GAMESdictionary. These are the link for keys claiming that will be output in a file. Ensure theCURRENCYis properly set to expected currency for your country.main.py: At the top of the file, theDB_URLconstant should point to a valid Database address. It will be used for data importing (from the JSON collected from Humble Bundle's website) and to make easier queries. If in doubt, you may use the providedsqlitecontent, which will use a local SQLite database as a file.template.html: This is the actual template used for generating the resulting HTML page with the keys listing. For more infos on how to use the template, refer toMakodocumentation
Retrieving the game list
python main.py download
This will output a output.json file with the required informations from your Humble Bundle.
If the download fails, make sure you properly updated the cookies as seen in the Prerequisites section
Importing the game list into the database
# Initialize the database.
# This will wipe all previous imported data.
python main.py init
# Import the data from the `output.json` file into the database
python main.py import output.json
Building the HTML listing page
python main.py gen
The default resulting file is located at /games.html.
Uploading game list to remote server
Copy the game list (located in /games.html) along with the required JavaScript on the remote server.
Claiming keys
Fill the requested keys in the data file, as explained in the prerequisite section.
Then run:
python main.py urls
The default resulting file is located at /codes.txt.
Licence
MIT