diff options
| author | Yaohan Chen <yaohan.chen@gmail.com> | 2014-04-01 01:21:59 -0400 | 
|---|---|---|
| committer | Yaohan Chen <yaohan.chen@gmail.com> | 2014-04-01 01:31:53 -0400 | 
| commit | 23fcf1acc62e0f32f479c12c1916b2b1dd922199 (patch) | |
| tree | 96ddaf09bb3cb901a9d9a0300bf2c14a37586de9 /hib-dlagent | |
| parent | bb224302e1720bf7119c5b3a2e3c394ce989ecc7 (diff) | |
| download | hib-dlagent-23fcf1acc62e0f32f479c12c1916b2b1dd922199.tar.gz hib-dlagent-23fcf1acc62e0f32f479c12c1916b2b1dd922199.zip | |
Support the new Humble Bundle page
Use PhantomJS to handle the dynamically generated page and captchas.
Add options to specify the location of PhantomJS scripts and
configuration file.
Update README on requirements, usage, and debugging information.
Update CHANGELOG.
Diffstat (limited to 'hib-dlagent')
| -rwxr-xr-x | hib-dlagent | 22 | 
1 files changed, 16 insertions, 6 deletions
| diff --git a/hib-dlagent b/hib-dlagent index fe09339..5c6a8a5 100755 --- a/hib-dlagent +++ b/hib-dlagent @@ -6,6 +6,9 @@ LOGIN_PAGE=https://www.humblebundle.com/login  HOME_PAGE=https://www.humblebundle.com/home  COOKIE_JAR= +SCRIPT_PATH='/usr/share/hib-dlagent' +CONFIG_PATH='/etc/hib-dlagent' +  FILE=  DESTINATION=  DOWNLOAD=1 @@ -19,15 +22,14 @@ login() {      read -rsp 'Enter Humble account password: ' PASSWORD      echo    fi -  printf '%s' "$PASSWORD" | \ -    curl -s --cookie-jar "$COOKIE_JAR" \ -      --data-urlencode "username=$USERNAME" --data-urlencode password@- "$LOGIN_PAGE" +  phantomjs --config="$CONFIG_PATH"/phantomjs-config.json --cookies-file="$COOKIE_JAR" \ +    "$SCRIPT_PATH"/login.coffee "$LOGIN_PAGE" "$USERNAME" "$PASSWORD"  }  discover_url() {    local LISTING_PAGE="$1" -  curl -s --cookie "$COOKIE_JAR" "$LISTING_PAGE" | grep "/$FILE?" | grep 'data-web=' | \ -    sed -e "s/.* data-web='\([^']*\)'.*/\1/" | head -n 1 +  phantomjs --config="$CONFIG_PATH"/phantomjs-config.json --cookies-file="$COOKIE_JAR" \ +    "$SCRIPT_PATH"/discover-url.coffee "$LISTING_PAGE" "$FILE" "$USERNAME" "$PASSWORD"  }  usage() { @@ -47,6 +49,8 @@ Options:   -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.  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 @@ -102,7 +106,7 @@ main() {      exit 1    fi -  while getopts "hd:k:o:p:P:su:" opt; do +  while getopts "hd:k:o:p:P:su:S:c:" opt; do      case $opt in        \?)          exit 1 @@ -132,6 +136,12 @@ main() {        u)          USERNAME="$OPTARG"        ;; +      S) +        SCRIPT_PATH="$OPTARG" +      ;; +      c) +        CONFIG_PATH="$OPTARG" +      ;;      esac    done | 
