diff options
author | Yaohan Chen <yaohan.chen@gmail.com> | 2014-04-01 12:56:00 -0400 |
---|---|---|
committer | Yaohan Chen <yaohan.chen@gmail.com> | 2014-04-01 12:57:15 -0400 |
commit | fff04d5a4aa157bb2ca6c259dd191eac51b62951 (patch) | |
tree | 46cb504b37156cefb6dfc6c2fef87f84166f915f | |
parent | c453cfad478d4a00e9e84780d4738e84ac360d4d (diff) | |
download | hib-dlagent-fff04d5a4aa157bb2ca6c259dd191eac51b62951.tar.gz hib-dlagent-fff04d5a4aa157bb2ca6c259dd191eac51b62951.zip |
Support passing additional PhantomJS options
-rw-r--r-- | README | 4 | ||||
-rwxr-xr-x | hib-dlagent | 36 |
2 files changed, 25 insertions, 15 deletions
@@ -47,3 +47,7 @@ Extracting URLs from Humble Bundle's mostly dynamically-generated website can be error-prone, and time consuming. Currently it can take about 20 seconds for the script to run. If the script fails or gets stuck, it may help to turn on logging by setting the LOG environment variable to a non-empty value. + +It is also possible to turn on PhantomJS's debug output with '-j --debug=true', +but note that this output is very verbose and targeted to developers, and it may +contain your Humble Bundle login information in plain text. diff --git a/hib-dlagent b/hib-dlagent index a90bdea..9dda7dd 100755 --- a/hib-dlagent +++ b/hib-dlagent @@ -19,8 +19,10 @@ STORAGE= discover_url() { local LISTING_PAGE="$1" - phantomjs --config="$CONFIG_PATH"/phantomjs-config.json --cookies-file="$COOKIE_JAR" \ - "$SCRIPT_PATH"/discover-url.coffee "$LISTING_PAGE" "$FILE" "$USERNAME" "$PASSWORD" + # Running a new shell in order to split PHANTOM_JS_OPTIONS into multiple arguments + sh -c "phantomjs --config='$CONFIG_PATH'/phantomjs-config.json --cookies-file='$COOKIE_JAR' \ + $PHANTOM_JS_OPTIONS \ + '$SCRIPT_PATH'/discover-url.coffee '$LISTING_PAGE' '$FILE' '$USERNAME' '$PASSWORD'" } usage() { @@ -30,18 +32,19 @@ Tool to download Humble Indie Bundle binaries by file name Usage: $0 [OPTIONS] FILE Options: - -d <dir> Directory for searching and saving files. The normal save location - is still used, but will be a symbolic link - -h This help - -k <key> Search key's files. Use multiple times for multiple keys - -o <file> Name to use when saving file - -p <pass> Use pass to login. If specified multiple times, the last is used - -P <pname> The name of the password available via gnome-keyring-query - -s Print URL to stdout instead of downloading. Incompatible with -d - -u <user> Use user to login. Search account's files. If specified multiple - times, the last is used - -S <dir> Directory where PhantomJs scripts are located. - -c <dir> Directory where configuration files are located. + -d <dir> Directory for searching and saving files. The normal save location + is still used, but will be a symbolic link + -h This help + -k <key> Search key's files. Use multiple times for multiple keys + -o <file> Name to use when saving file + -p <pass> Use pass to login. If specified multiple times, the last is used + -P <pname> The name of the password available via gnome-keyring-query + -s Print URL to stdout instead of downloading. Incompatible with -d + -u <user> Use user to login. Search account's files. If specified multiple + times, the last is used + -S <dir> Directory where PhantomJS scripts are located. + -c <dir> Directory where configuration files are located. + -j <options> Additional options passed to PhantomJS If you specify -u, then all of that account's bundles are searched. If a key is associated with a HIB account then you must use -u/-p, since that key only works @@ -96,7 +99,7 @@ main() { exit 1 fi - while getopts "hd:k:o:p:P:su:S:c:" opt; do + while getopts "hd:k:o:p:P:su:S:c:j:" opt; do case $opt in \?) exit 1 @@ -132,6 +135,9 @@ main() { c) CONFIG_PATH="$OPTARG" ;; + j) + PHANTOM_JS_OPTIONS="$OPTARG" + ;; esac done |