-
-
Save pright/a006af806df84770876e to your computer and use it in GitHub Desktop.
zimuzu.tv 签到脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ACCOUNT="" | |
| PASSWORD="" | |
| ######################################### | |
| function urlEncode() { | |
| python -c " | |
| import urllib, commands, os; | |
| var = commands.getoutput('echo \'$1\''); | |
| var = urllib.quote_plus(var); | |
| os.system('echo ' + var);" | |
| } | |
| DOMAIN="http://www.zimuzu.tv" | |
| COOKIE="/tmp/zimuzu.cookie" | |
| REMEMBER="1" | |
| REDIRECT="$DOMAIN/user/sign" | |
| ExpectedResponseText='{"status":0,"info":"","data":0}' | |
| RetryCount=1 | |
| # 登錄 | |
| curl -d "account=$(urlEncode $ACCOUNT)&password=$(urlEncode $PASSWORD)&remember=$(urlEncode $REMEMBER)&url_back=$(urlEncode $REDIRECT)" \ | |
| -c "$COOKIE" -s "$DOMAIN/User/Login/ajaxLogin" | |
| echo '' | |
| sleep 1 | |
| # 要先打開簽到頁面 | |
| curl -s --cookie "$COOKIE" "$REDIRECT" > /dev/null | |
| curl -s --cookie "$COOKIE" "$DOMAIN/user/login/getCurUserTopInfo" | |
| echo '' | |
| # 等15秒再簽到 | |
| sleep 15 | |
| while true; do | |
| Response=$(curl -s --cookie "$COOKIE" "$DOMAIN/user/sign/dosign") | |
| echo "$(date '+%H:%M:%S') \t $RetryCount \t $Response"; | |
| ((RetryCount++)) | |
| if [ "$Response" == "$ExpectedResponseText" -o "$RetryCount" -gt 6 ]; then | |
| break | |
| fi | |
| sleep 2 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment