|
@@ -388,75 +388,68 @@ def get_ticket_order(account, passwd, target_url, single_proxy):
|
|
|
loggerKit.info(f'proxies: {proxies}')
|
|
loggerKit.info(f'proxies: {proxies}')
|
|
|
|
|
|
|
|
# session
|
|
# session
|
|
|
- # if redis_client.get(f'token_{account}') is None:
|
|
|
|
|
- #
|
|
|
|
|
- # """
|
|
|
|
|
- # 模拟登录
|
|
|
|
|
- # """
|
|
|
|
|
- # # 定义请求地址
|
|
|
|
|
- # stamp = str(int(time.time()))
|
|
|
|
|
- # login_url = f"https://t.livepocket.jp/api/sessions/create?mytimestamp={stamp}"
|
|
|
|
|
- #
|
|
|
|
|
- # # 定义请求header
|
|
|
|
|
- # headers = {'Content-Type': 'application/x-www-form-urlencoded;',
|
|
|
|
|
- # 'Referer': 'https://t.livepocket.jp/login?acroot=header-new_p_u_nl',
|
|
|
|
|
- # 'Sec-Ch-Ua': 'Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99',
|
|
|
|
|
- # 'User-Agent': user_agent,
|
|
|
|
|
- # 'path': f'/api/sessions/create?mytimestamp={stamp}',
|
|
|
|
|
- # 'Origin': 'https://t.livepocket.jp',
|
|
|
|
|
- # 'Sec-Ch-Ua-Mobile': '?0',
|
|
|
|
|
- # 'Sec-Fetch-Mode': 'cors',
|
|
|
|
|
- # 'Sec-Fetch-Site': 'same-origin',
|
|
|
|
|
- # 'Priority': 'u=1, i'
|
|
|
|
|
- # }
|
|
|
|
|
- #
|
|
|
|
|
- # # 通过字典方式定义请求body
|
|
|
|
|
- # form_data = {"login": account,
|
|
|
|
|
- # "password": passwd,
|
|
|
|
|
- # "auto_login": "on",
|
|
|
|
|
- # "login_password": f"{account}&{passwd}"
|
|
|
|
|
- # }
|
|
|
|
|
- #
|
|
|
|
|
- # data = parse.urlencode(form_data)
|
|
|
|
|
- # session = requests.session()
|
|
|
|
|
- # content = session.post(url=login_url, headers=headers, data=data, proxies=proxies).text
|
|
|
|
|
- # # loggerKit.info(f'login info: {content}')
|
|
|
|
|
- # if 'token' not in content:
|
|
|
|
|
- # loggerKit.info(
|
|
|
|
|
- # f'login account:{account}, 登录过期,自动重新登录!!!')
|
|
|
|
|
- #
|
|
|
|
|
- # # # 生成 2 到 6 分之间的随机等待时间
|
|
|
|
|
- # # wait_time = random.uniform(120, 180)
|
|
|
|
|
- # # # 打印等待时间并等待
|
|
|
|
|
- # # loggerKit.info(f"等待 {wait_time:.2f} 秒...")
|
|
|
|
|
- # # time.sleep(wait_time)
|
|
|
|
|
- #
|
|
|
|
|
- # return
|
|
|
|
|
- #
|
|
|
|
|
- # cookie = session.cookies
|
|
|
|
|
- # response_cookie = cookie.get_dict()
|
|
|
|
|
- # login_resp = json.loads(content)
|
|
|
|
|
- # token = login_resp['result']['token']
|
|
|
|
|
- # login_session = response_cookie['ci_session']
|
|
|
|
|
- # php_session = response_cookie['PHPSESSID']
|
|
|
|
|
- # loggerKit.info(f'login account:{account}, 代理IP:{single_proxy}, token: {token} login success!!!')
|
|
|
|
|
- # redis_client.set(f'token_{account}', token)
|
|
|
|
|
- # redis_client.set(f'php_session_{account}', php_session)
|
|
|
|
|
- # redis_client.set(f'ci_session_{account}', login_session)
|
|
|
|
|
- #
|
|
|
|
|
- # file_writer.write_to_file(f'login account:{account}, 代理IP:{single_proxy}, token: {token} 登录成功!!!')
|
|
|
|
|
- # else:
|
|
|
|
|
- # token = redis_client.get(f'token_{account}')
|
|
|
|
|
- # login_session = redis_client.get(f'ci_session_{account}')
|
|
|
|
|
- # php_session = redis_client.get(f'php_session_{account}')
|
|
|
|
|
-
|
|
|
|
|
- token = redis_client.get(f'token_{account}')
|
|
|
|
|
- login_session = redis_client.get(f'ci_session_{account}')
|
|
|
|
|
- php_session = redis_client.get(f'php_session_{account}')
|
|
|
|
|
-
|
|
|
|
|
- if token is None:
|
|
|
|
|
- loggerKit.warning(f"account's:{account} token is None")
|
|
|
|
|
- print(f"account's:{account} token is None")
|
|
|
|
|
|
|
+ if redis_client.get(f'token_{account}') is None:
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+ 模拟登录
|
|
|
|
|
+ """
|
|
|
|
|
+ # 定义请求地址
|
|
|
|
|
+ stamp = str(int(time.time()))
|
|
|
|
|
+ login_url = f"https://t.livepocket.jp/api/sessions/create?mytimestamp={stamp}"
|
|
|
|
|
+
|
|
|
|
|
+ # 定义请求header
|
|
|
|
|
+ headers = {'Content-Type': 'application/x-www-form-urlencoded;',
|
|
|
|
|
+ 'Referer': 'https://t.livepocket.jp/login?acroot=header-new_p_u_nl',
|
|
|
|
|
+ 'Sec-Ch-Ua': 'Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99',
|
|
|
|
|
+ 'User-Agent': user_agent,
|
|
|
|
|
+ 'path': f'/api/sessions/create?mytimestamp={stamp}',
|
|
|
|
|
+ 'Origin': 'https://t.livepocket.jp',
|
|
|
|
|
+ 'Sec-Ch-Ua-Mobile': '?0',
|
|
|
|
|
+ 'Sec-Fetch-Mode': 'cors',
|
|
|
|
|
+ 'Sec-Fetch-Site': 'same-origin',
|
|
|
|
|
+ 'Priority': 'u=1, i'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ # 通过字典方式定义请求body
|
|
|
|
|
+ form_data = {"login": account,
|
|
|
|
|
+ "password": passwd,
|
|
|
|
|
+ "auto_login": "on",
|
|
|
|
|
+ "login_password": f"{account}&{passwd}"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ data = parse.urlencode(form_data)
|
|
|
|
|
+ session = requests.session()
|
|
|
|
|
+ content = session.post(url=login_url, headers=headers, data=data, proxies=proxies).text
|
|
|
|
|
+ # loggerKit.info(f'login info: {content}')
|
|
|
|
|
+ if 'token' not in content:
|
|
|
|
|
+ loggerKit.info(
|
|
|
|
|
+ f'login account:{account}, 登录过期,自动重新登录!!!')
|
|
|
|
|
+
|
|
|
|
|
+ # # 生成 2 到 6 分之间的随机等待时间
|
|
|
|
|
+ # wait_time = random.uniform(120, 180)
|
|
|
|
|
+ # # 打印等待时间并等待
|
|
|
|
|
+ # loggerKit.info(f"等待 {wait_time:.2f} 秒...")
|
|
|
|
|
+ # time.sleep(wait_time)
|
|
|
|
|
+
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ cookie = session.cookies
|
|
|
|
|
+ response_cookie = cookie.get_dict()
|
|
|
|
|
+ login_resp = json.loads(content)
|
|
|
|
|
+ token = login_resp['result']['token']
|
|
|
|
|
+ login_session = response_cookie['ci_session']
|
|
|
|
|
+ php_session = response_cookie['PHPSESSID']
|
|
|
|
|
+ loggerKit.info(f'login account:{account}, 代理IP:{single_proxy}, token: {token} login success!!!')
|
|
|
|
|
+ redis_client.set(f'token_{account}', token)
|
|
|
|
|
+ redis_client.set(f'php_session_{account}', php_session)
|
|
|
|
|
+ redis_client.set(f'ci_session_{account}', login_session)
|
|
|
|
|
+
|
|
|
|
|
+ file_writer.write_to_file(f'login account:{account}, 代理IP:{single_proxy}, token: {token} 登录成功!!!')
|
|
|
|
|
+ else:
|
|
|
|
|
+ token = redis_client.get(f'token_{account}')
|
|
|
|
|
+ login_session = redis_client.get(f'ci_session_{account}')
|
|
|
|
|
+ php_session = redis_client.get(f'php_session_{account}')
|
|
|
|
|
+
|
|
|
|
|
|
|
|
# event_id
|
|
# event_id
|
|
|
# 从redis中查询,查询不到再去请求
|
|
# 从redis中查询,查询不到再去请求
|