def shareBox(headers): """ 宝箱分享 :param headers: :return: """ time.sleep(0.3) url = '{b}invite/shareEnd'.format(b=YOUTH_HOST) try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('宝箱分享') print(response) if response['code'] == 1: return response['data'] else: return except: print(traceback.format_exc()) return
def friendSign(headers, uid): """ 好友签到 :param headers: :return: """ time.sleep(0.3) url = '{b}ShareSignNew/sendScoreV2?friend_uid={uid}'.format(b=YOUTH_HOST, c=uid) try: response = requests_session().get(url=url, headers=headers, timeout=30).json() print('好友签到') print(response) if response['error_code'] == '0': return response['data'] else: return except: print(traceback.format_exc()) return
def luckDraw(headers): """ 打卡分享 :param headers: :return: """ time.sleep(0.3) url = '{b}PunchCard/luckdraw'.format(b=YOUTH_HOST) try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('七日签到') print(response) if response['code'] == 1: return response['data'] else: return except: print(traceback.format_exc()) return
def punchCard(headers): """ 打卡报名 :param headers: :return: """ time.sleep(0.3) url = '{b}PunchCard/signUp'.format(b=YOUTH_HOST) try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('打卡报名') print(response) if response['code'] == 1: return response else: return except: print(traceback.format_exc()) return
def card_exchangeCard(cookies, toCardAwardId, fromRecordIdList): fromRecordIdList = sorted(fromRecordIdList) headers = { 'User-Agent': UserAgent, 'Content-Type': 'application/json;charset=utf-8', 'Host': 'm.ximalaya.com', 'Origin': 'https://m.ximalaya.com', 'Referer': 'https://m.ximalaya.com/xmds-node-spa/apps/speed-growth-activities/card-collection/home', } data = { "toCardAwardId": toCardAwardId, "fromRecordIdList": fromRecordIdList, "exchangeType": 1, } try: response = requests_session().post('https://m.ximalaya.com/speed/web-earn/card/exchangeCard', headers=headers, cookies=cookies, data=json.dumps(data)) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return print(response.text)
def sendTwentyScore(headers, action): """ 每日任务 :param headers: :return: """ time.sleep(0.3) url = '{b}NewTaskIos/sendTwentyScore?{popo}&action={d}'.format( b=YOUTH_HOST, popo=headers["Referer"].split("?")[1], d=action) try: response = requests_session().get(url=url, headers=headers, timeout=30).json() print('每日任务 {}'.format(action)) print(response) if response['status'] == 1: return response else: return except: print(traceback.format_exc()) return
def incomeStat(headers): """ 收益统计 :param headers: :return: """ time.sleep(0.3) url = 'https://kd.youth.cn/wap/user/balance?{dd}'.format( dd=headers["Referer"].split("?")[1]) try: response = requests_session().get(url=url, headers=headers, timeout=50).json() print('收益统计') print(response) if response['status'] == 0: return response else: return except: print(traceback.format_exc()) return
def threeShare(headers, action): """ 三餐分享 :param headers: :return: """ time.sleep(0.3) url = f'{YOUTH_HOST}ShareNew/execExtractTask' headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8' body = f'{headers["Referer"].split("?")[1]}&action={action}' try: response = requests_session().post(url=url, data=body, headers=headers, timeout=30).json() print('三餐分享') print(response) return except: print(traceback.format_exc()) return
def read_books(headers, book_url, upload_time): """ 刷时长 :param headers: :return: """ findtime = re.compile(r'readTime=(.*?)&read_') url = re.sub( findtime.findall(book_url)[0], str(upload_time * 60 * 1000), str(book_url)) # url = book_url.replace('readTime=', 'readTime=' + str(upload_time)) try: response = requests_session().get(url=url, headers=headers, timeout=30).json() if response['code'] == 0: return True else: return except: print(traceback.format_exc()) return
def receive(cookies, taskId): headers = { 'Host': 'm.ximalaya.com', 'Accept': 'application/json, text/plain, */*', 'Connection': 'keep-alive', 'User-Agent': UserAgent, 'Accept-Language': 'zh-cn', 'Referer': 'https://m.ximalaya.com/xmds-node-spa/apps/speed-growth-open-components/bubble', 'Accept-Encoding': 'gzip, deflate, br', } try: response = requests_session().get( f'https://m.ximalaya.com/speed/web-earn/listen/receive/{taskId}', headers=headers, cookies=cookies) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return print("receive: ", response.text) return response.json()
def sign(headers): """ 签到 :param headers: :return: """ time.sleep(0.3) url = 'https://kd.youth.cn/TaskCenter/sign' try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('签到') print(response) if response['status'] == 1: return response else: return except: print(traceback.format_exc()) return
def bereadRed(headers): """ 时段红包 :param headers: :return: """ time.sleep(0.3) url = '{b}Task/receiveBereadRed'.format(b=YOUTH_HOST) try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('时段红包') print(response) if response['code'] == 1: return response['data'] else: return except: print(traceback.format_exc()) return
def track(headers, body): """ 数据追踪,解决1金币问题 :param headers: :param body: :return: """ try: url = 'https://mqqapi.reader.qq.com/log/v4/mqq/track' timestamp = re.compile(r'"dis": (.*?),') body = json.dumps(body) body = re.sub(timestamp.findall(body)[0], str( int(time.time() * 1000)), str(body)) response = requests_session().post( url=url, headers=headers, data=body, timeout=30).json() if response['code'] == 0: return True else: return except: print(traceback.format_exc()) return
def openBox(headers): """ 开启宝箱 :param headers: :return: """ time.sleep(0.3) url = f'{YOUTH_HOST}invite/openHourRed' try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('开启宝箱') print(response) if response['code'] == 1: share_box_res = shareBox(headers=headers) return response['data'] else: return except: print(traceback.format_exc()) return
def doCard(headers): """ 早起打卡 :param headers: :return: """ time.sleep(0.3) url = f'{YOUTH_HOST}PunchCard/doCard' try: response = requests_session().post(url=url, headers=headers, timeout=30).json() print('早起打卡') print(response) if response['code'] == 1: shareCard(headers=headers) return response['data'] else: return except: print(traceback.format_exc()) return
def draw_5card(cookies, drawRecordIdList): # 五连抽 drawRecordIdList = sorted(drawRecordIdList) headers = { 'User-Agent': UserAgent, 'Content-Type': 'application/json;charset=utf-8', 'Host': 'm.ximalaya.com', 'Origin': 'https://m.ximalaya.com', 'Referer': 'https://m.ximalaya.com/xmds-node-spa/apps/speed-growth-activities/card-collection/home', } uid = get_uid(cookies) data = { "signData": rsa_encrypt(f"{''.join(str(i) for i in drawRecordIdList)}{uid}", pubkey_str), "drawRecordIdList": drawRecordIdList, "drawType": 2, } try: response = requests_session().post('https://m.ximalaya.com/speed/web-earn/card/draw', headers=headers, cookies=cookies, data=json.dumps(data)) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return print("五连抽: ", response.text)
def withdraw(body): """ 自动提现 :param headers: :return: """ time.sleep(0.3) url = 'https://ios.baertt.com/v5/wechat/withdraw2.json' headers = { 'User-Agent': 'KDApp/1.8.0 (iPhone; iOS 14.2; Scale/3.00)', 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' } try: response = requests_session().post(url=url, headers=headers, data=body, timeout=30).json() print('自动提现') print(response) if response['success'] == True: return response['items'] else: return except: print(traceback.format_exc()) return
def readTime(body): """ 阅读时长 :param headers: :return: """ time.sleep(0.3) url = 'https://ios.baertt.com/v5/user/stay.json' headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' } try: response = requests_session().post(url=url, data=body, headers=headers, timeout=30).json() print('阅读时长') print(response) if response['error_code'] == '0': return response else: return except: print(traceback.format_exc()) return
def articleRed(body): """ 惊喜红包 :param headers: :return: """ time.sleep(0.3) url = 'https://ios.baertt.com/v5/article/red_packet.json' headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' } try: response = requests_session().post(url=url, data=body, headers=headers, timeout=30).json() print('惊喜红包') print(response) if response['success'] == True: return response['items'] else: return except: print(traceback.format_exc()) return
def task_out_info(cookies): print("\n【获取提现信息】") headers = { 'Host': 'm.ximalaya.com', 'Content-Type': 'application/json;charset=utf-8', 'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'User-Agent': UserAgent, 'Referer': 'https://m.ximalaya.com/growth-ssr-speed-welfare-center/page/withdraw', 'Accept-Language': 'zh-cn', 'Accept-Encoding': 'gzip, deflate, br', } try: response = requests_session().get( 'https://m.ximalaya.com/speed/web-earn/account/take-out/info', headers=headers, cookies=cookies).json() print(response) if response['code'] == 0: return response['data'][-1] else: return except: print("网络请求异常,为避免GitHub action报错,直接跳过") return
def ans_getTimes(cookies): headers = { 'Host': 'm.ximalaya.com', 'Accept': 'application/json, text/plain, */*', 'Connection': 'keep-alive', 'User-Agent': UserAgent, 'Accept-Language': 'zh-cn', 'Referer': 'https://m.ximalaya.com/growth-ssr-speed-welfare-center/page/quiz', 'Accept-Encoding': 'gzip, deflate, br', } try: response = requests_session().get( 'https://m.ximalaya.com/speed/web-earn/topic/user', headers=headers, cookies=cookies) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return {"stamina": 0, "remainingTimes": 0} print(response.text) result = response.json() stamina = result["data"]["stamina"] remainingTimes = result["data"]["remainingTimes"] return {"stamina": stamina, "remainingTimes": remainingTimes}
def doubleRotary(headers, body): """ 转盘双倍 :param headers: :return: """ time.sleep(0.3) currentTime = time.time() url = f'{YOUTH_HOST}RotaryTable/toTurnDouble?_={currentTime}' try: response = requests_session().post(url=url, data=body, headers=headers, timeout=30).json() print('转盘双倍') print(response) if response['status'] == 1: return response['data'] else: return except: print(traceback.format_exc()) return
def watchAdVideo(headers): """ 看广告视频 :param headers: :return: """ time.sleep(0.3) url = 'https://kd.youth.cn/taskCenter/getAdVideoReward' headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8' try: response = requests_session().post(url=url, data="type=taskCenter", headers=headers, timeout=30).json() print('看广告视频') print(response) if response['status'] == 1: return response else: return except: print(traceback.format_exc()) return
def runRotary(headers, body): """ 转盘宝箱 :param headers: :return: """ time.sleep(0.3) currentTime = time.time() url = '{b}RotaryTable/chestReward?_={e}'.format(b=YOUTH_HOST, e=currentTime) try: response = requests_session().post(url=url, data=body, headers=headers, timeout=30).json() print('领取宝箱') print(response) if response['status'] == 1: return response['data'] else: return except: print(traceback.format_exc()) return
def account(cookies): print("\n【 打印账号信息】") headers = { 'Host': 'm.ximalaya.com', 'Content-Type': 'application/json;charset=utf-8', 'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'User-Agent': UserAgent, 'Referer': 'https://m.ximalaya.com/speed/web-earn/wallet', 'Accept-Language': 'zh-cn', 'Accept-Encoding': 'gzip, deflate, br', } try: response = requests_session().get( 'https://m.ximalaya.com/speed/web-earn/account/coin', headers=headers, cookies=cookies) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return '', '', '' result = response.json() total = result["total"]/10000 todayTotal = result["todayTotal"]/10000 historyTotal = result["historyTotal"]/10000 print(f"""当前剩余:{total}\n今日获得:{todayTotal}\n累计获得:{historyTotal}\n""") return total, todayTotal, historyTotal
def cardReportTime(cookies, mins, date_stamp, _datatime): print("\n【收听获得抽卡机会】") headers = { 'User-Agent': UserAgent, 'Content-Type': 'application/json;charset=utf-8', 'Host': 'm.ximalaya.com', 'Origin': 'https://m.ximalaya.com', 'Referer': 'https://m.ximalaya.com/xmds-node-spa/apps/speed-growth-activities/card-collection/home', } listenTime = mins-date_stamp uid = get_uid(cookies) data = {"listenTime": listenTime, "signData": rsa_encrypt(f"{_datatime}{listenTime}{uid}", pubkey_str), } try: response = requests_session().post('https://m.ximalaya.com/speed/web-earn/card/reportTime', headers=headers, cookies=cookies, data=json.dumps(data)).json() except: print("网络请求异常,为避免GitHub action报错,直接跳过") return try: response["data"]["upperLimit"] print("今日已达上限") except: return
def ans_restore(cookies): headers = { 'User-Agent': UserAgent, 'Content-Type': 'application/json;charset=utf-8', 'Host': 'm.ximalaya.com', 'Origin': 'https://m.ximalaya.com', 'Referer': 'https://m.ximalaya.com/growth-ssr-speed-welfare-center/page/quiz', } checkData = rsa_encrypt("restoreType=2", pubkey_str) data = { "restoreType": 2, "checkData": checkData, } try: response = requests_session().post('https://m.ximalaya.com/speed/web-earn/topic/restore', headers=headers, cookies=cookies, data=json.dumps(data)) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return 0 result = response.json() if "errorCode" in result: return 0 return 1
def ans_receive(cookies, paperId, lastTopicId, receiveType): headers = { 'User-Agent': UserAgent, 'Content-Type': 'application/json;charset=utf-8', 'Host': 'm.ximalaya.com', 'Origin': 'https://m.ximalaya.com', 'Referer': 'https://m.ximalaya.com/growth-ssr-speed-welfare-center/page/quiz', } _checkData = f"""lastTopicId={lastTopicId}&numOfAnswers=3&receiveType={receiveType}""" checkData = rsa_encrypt(str(_checkData), pubkey_str) data = { "paperId": paperId, "checkData": checkData, "lastTopicId": lastTopicId, "numOfAnswers": 3, "receiveType": receiveType } try: response = requests_session().post('https://m.ximalaya.com/speed/web-earn/topic/receive', headers=headers, cookies=cookies, data=json.dumps(data)) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return 0 return response.json()
def friendList(headers): """ 好友列表 :param headers: :return: """ time.sleep(0.3) url = f'{YOUTH_HOST}ShareSignNew/getFriendActiveList' try: response = requests_session().get(url=url, headers=headers, timeout=30).json() print('好友列表') print(response) if response['error_code'] == '0': if len(response['data']['active_list']) > 0: for friend in response['data']['active_list']: if friend['button'] == 1: time.sleep(1) friendSign(headers=headers, uid=friend['uid']) return response['data'] else: return except: print(traceback.format_exc()) return
def read(cookies): print("\n【阅读】") headers = { 'Host': '51gzdhh.xyz', 'accept': 'application/json, text/plain, */*', 'origin': 'http://xiaokuohao.work', 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0.1; MI 6 Plus Build/V417IR; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 iting(main)/1.8.18/android_1 kdtUnion_iting/1.8.18', 'referer': 'http://xiaokuohao.work/static/web/dxmly/index.html', 'accept-encoding': 'gzip, deflate', 'accept-language': 'zh-CN,en-US;q=0.8', 'x-requested-with': 'com.ximalaya.ting.lite', } params = (('hid', '233'), ) try: response = requests_session().get( 'https://51gzdhh.xyz/api/new/newConfig', headers=headers, params=params) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return result = response.json() pid = str(result["pid"]) headers = { 'Host': '51gzdhh.xyz', 'content-length': '37', 'accept': 'application/json, text/plain, */*', 'origin': 'http://xiaokuohao.work', 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0.1; MI 6 Plus Build/V417IR; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 iting(main)/1.8.18/android_1 kdtUnion_iting/1.8.18', 'content-type': 'application/x-www-form-urlencoded', 'referer': 'http://xiaokuohao.work/static/web/dxmly/index.html', 'accept-encoding': 'gzip, deflate', 'accept-language': 'zh-CN,en-US;q=0.8', 'x-requested-with': 'com.ximalaya.ting.lite', } uid = get_uid(cookies) data = {"pid": str(pid), "mtuserid": uid} try: response = requests_session().post( 'https://51gzdhh.xyz/api/new/hui/complete', headers=headers, data=json.dumps(data)) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return result = response.json() if result["status"] == -2: # print("无法阅读,尝试从安卓端手动开启") return # print(result["completeList"]) if result["isComplete"] or result["count_finish"] == 9: print("今日完成阅读") return headers = { 'Host': '51gzdhh.xyz', 'accept': 'application/json, text/plain, */*', 'origin': 'http://xiaokuohao.work', 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0.1; MI 6 Plus Build/V417IR; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.100 Mobile Safari/537.36 iting(main)/1.8.18/android_1 kdtUnion_iting/1.8.18', 'referer': 'http://xiaokuohao.work/static/web/dxmly/index.html', 'accept-encoding': 'gzip, deflate', 'accept-language': 'zh-CN,en-US;q=0.8', 'x-requested-with': 'com.ximalaya.ting.lite', } taskIds = set([ '242', '239', '241', '240', '238', '236', '237', '235', '234' ]) - set(result["completeList"]) params = ( ('userid', str(uid)), ('pid', pid), ('taskid', taskIds.pop()), ('imei', ''), ) try: response = requests_session().get( 'https://51gzdhh.xyz/new/userCompleteNew', headers=headers, params=params) except: print("网络请求异常,为避免GitHub action报错,直接跳过") return 0 result = response.json() print(result)