mirror of
https://github.com/xtream1101/humblebundle-downloader.git
synced 2025-02-01 19:42:43 +01:00
Updated readme regarding cookies. Added --session-auth cookie option. Fixed #32, Fixed #37, Fixed #30
This commit is contained in:
parent
b335e35242
commit
c451d407d8
12
README.md
12
README.md
@ -24,9 +24,15 @@ The first time this runs it may take a while because it will download everything
|
||||
## Instructions
|
||||
|
||||
### 1. Getting cookies
|
||||
First thing to do is get your account cookies. The cookies should be in the Netscape format. You can get them by using a browser extension. These are the ones that I tested, but others may work as well...
|
||||
- Firefox: https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/
|
||||
- Chrome: https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/
|
||||
First thing to do is get your account cookies. This can be done by getting a browser extension that lest you see or export your cookies.
|
||||
|
||||
- **Method 1 (recommended)**
|
||||
- Get the value of the cookie called `_simpleauth_sess` and pass that value using `-s "COOKIE_VALUE"`
|
||||
|
||||
- **Method 2**
|
||||
- Export the cookies in the Netscape format using an extension.
|
||||
If your exported cookie file is not working, it may be a formatting issue, this can be fixed by running the command `curl -b cookies.orig.txt --cookie-jar cookies.txt http://bogus`
|
||||
|
||||
|
||||
### 2. Downloading your library
|
||||
Use the following command to download your Humble Bundle Library:
|
||||
|
@ -25,10 +25,14 @@ def cli():
|
||||
'download',
|
||||
help="Download content in your humble bundle library",
|
||||
)
|
||||
parser_download.add_argument(
|
||||
cookie = parser_download.add_mutually_exclusive_group(required=True)
|
||||
cookie.add_argument(
|
||||
'-c', '--cookie-file', type=str,
|
||||
help="Location of the cookies file",
|
||||
required=True,
|
||||
)
|
||||
cookie.add_argument(
|
||||
'-s', '--session-auth', type=str,
|
||||
help="Value of the cookie _simpleauth_sess. WRAP IN QUOTES",
|
||||
)
|
||||
parser_download.add_argument(
|
||||
'-l', '--library-path', type=str,
|
||||
@ -80,8 +84,9 @@ def cli():
|
||||
# Still keep the download action to keep compatibility
|
||||
from .download_library import DownloadLibrary
|
||||
DownloadLibrary(
|
||||
cli_args.cookie_file,
|
||||
cli_args.library_path,
|
||||
cookie_path=cli_args.cookie_file,
|
||||
cookie_auth=cli_args.session_auth,
|
||||
progress_bar=cli_args.progress,
|
||||
ext_include=cli_args.include,
|
||||
ext_exclude=cli_args.exclude,
|
||||
|
@ -23,9 +23,10 @@ def _clean_name(dirty_str):
|
||||
|
||||
class DownloadLibrary:
|
||||
|
||||
def __init__(self, cookie_path, library_path, progress_bar=False,
|
||||
ext_include=None, ext_exclude=None, platform_include=None,
|
||||
purchase_keys=None, trove=False, update=False):
|
||||
def __init__(self, library_path, cookie_path=None, cookie_auth=None,
|
||||
progress_bar=False, ext_include=None, ext_exclude=None,
|
||||
platform_include=None, purchase_keys=None, trove=False,
|
||||
update=False):
|
||||
self.library_path = library_path
|
||||
self.progress_bar = progress_bar
|
||||
self.ext_include = [] if ext_include is None else list(map(str.lower, ext_include)) # noqa: E501
|
||||
@ -42,14 +43,19 @@ class DownloadLibrary:
|
||||
self.update = update
|
||||
|
||||
self.session = requests.Session()
|
||||
try:
|
||||
cookie_jar = http.cookiejar.MozillaCookieJar(cookie_path)
|
||||
cookie_jar.load()
|
||||
self.session.cookies = cookie_jar
|
||||
except http.cookiejar.LoadError:
|
||||
# Still support the original cookie method
|
||||
with open(cookie_path, 'r') as f:
|
||||
self.session.headers.update({'cookie': f.read().strip()})
|
||||
if cookie_path:
|
||||
try:
|
||||
cookie_jar = http.cookiejar.MozillaCookieJar(cookie_path)
|
||||
cookie_jar.load()
|
||||
self.session.cookies = cookie_jar
|
||||
except http.cookiejar.LoadError:
|
||||
# Still support the original cookie method
|
||||
with open(cookie_path, 'r') as f:
|
||||
self.session.headers.update({'cookie': f.read().strip()})
|
||||
elif cookie_auth:
|
||||
self.session.headers.update(
|
||||
{'cookie': '_simpleauth_sess={}'.format(cookie_auth)}
|
||||
)
|
||||
|
||||
def start(self):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user