예제 #1
0
파일: zhanqi.py 프로젝트: 5ace/ZhanqiTV
def login(captchaKey):
    captcha = input('captcha:')
    params = urllib.parse.urlencode({'captcha': captcha, 'password': '******', 'account': 'zephyrzoom', 'captchaKey': captchaKey})
    mylog.writeLog('post', ZHANQI_URL + LOGIN_URL + '?' + params)
    urllib.request.install_opener(opener)
    with urllib.request.urlopen(ZHANQI_URL + LOGIN_URL + '?' + params) as f:
        loginInfo = f.read().decode('utf-8')
        mylog.writeLog('login', loginInfo)
예제 #2
0
파일: zhanqi.py 프로젝트: 5ace/ZhanqiTV
def getCaptcha():
    with urllib.request.urlopen(ZHANQI_URL + CAPTCHA_URL) as f:
        captchaJson = f.read().decode('utf-8')
        mylog.writeLog('get', captchaJson)
        captchaDict = json.loads(captchaJson)
        #mylog.writeLog('info', captchaDict)
        captchaImg = captchaDict['data']['img']
        captchaKey = captchaDict['data']['captchaKey']
        mylog.writeLog('img', captchaImg)
        print(captchaImg)
        return captchaKey