|
|
@@ -1,4 +1,6 @@
|
|
|
import re
|
|
|
+import time
|
|
|
+from urllib import parse
|
|
|
|
|
|
import requests
|
|
|
|
|
|
@@ -47,7 +49,7 @@ def poc_1():
|
|
|
|
|
|
|
|
|
def get_ticket_info():
|
|
|
- url = 'https://t.livepocket.jp/e/pp20240515'
|
|
|
+ url = 'https://t.livepocket.jp/e/lxyyc'
|
|
|
response = requests.get(url)
|
|
|
if response.status_code == 200:
|
|
|
html_string = response.text
|
|
|
@@ -59,5 +61,61 @@ def get_ticket_info():
|
|
|
print("未找到匹配的数值")
|
|
|
|
|
|
|
|
|
+def get_event_id():
|
|
|
+ url = 'https://t.livepocket.jp/e/lxyyc'
|
|
|
+
|
|
|
+ response = requests.get(url)
|
|
|
+ if response.status_code == 200:
|
|
|
+ html_string = response.content.decode('utf8')
|
|
|
+ start_index = html_string.find('https://t.livepocket.jp/purchase/verify?event_id=')
|
|
|
+ if start_index != -1:
|
|
|
+ end_index = html_string.find("'", start_index)
|
|
|
+ if end_index != -1:
|
|
|
+ event_id = html_string[start_index + len('https://t.livepocket.jp/purchase/verify?event_id='):end_index]
|
|
|
+ print(f'event_id: {event_id}')
|
|
|
+ else:
|
|
|
+ print('End index not found.')
|
|
|
+ else:
|
|
|
+ print('Substring not found.')
|
|
|
+ else:
|
|
|
+ print('Failed to fetch the page. Status code:', response.status_code)
|
|
|
+
|
|
|
+
|
|
|
+def get_my_session_id(account, passwd):
|
|
|
+ """
|
|
|
+ 模拟登录
|
|
|
+ """
|
|
|
+ # 定义请求地址
|
|
|
+ login_url = "https://t.livepocket.jp/api/sessions/create?mytimestamp=" + str(int(time.time()))
|
|
|
+
|
|
|
+ # 定义请求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',
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
|
|
|
+ }
|
|
|
+
|
|
|
+ # 通过字典方式定义请求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=None).text
|
|
|
+ cookie = session.cookies
|
|
|
+ response_cookie = cookie.get_dict()
|
|
|
+ # login_resp = json.loads(content)
|
|
|
+ # token = login_resp['result']['token']
|
|
|
+ # print('response cookie: ', response_cookie)
|
|
|
+ print('response_cookie: ', response_cookie)
|
|
|
+
|
|
|
+ # 跳转到抢券
|
|
|
+ login_session = response_cookie['ci_session']
|
|
|
+ print(login_session)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
- get_ticket_info()
|
|
|
+ get_my_session_id('n0l1a@huatcn.com', 'panyue666')
|