import json import requests def test_poc(): url = 'https://t.livepocket.jp/api/purchased_tickets/total_list' headers = { 'Accept-Encoding': 'gzip, deflate, br, zstd', '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', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Cache-Control': 'no-cache', 'Cookie': 'ci_session=TB9aP0ffcS6uK2rhcUxhb1uF8ZUaWY7oqwDg3OpGk2zZmFYAihTkYadqnniR%2FoQ7g8KCK7RXdNJ109aeJcryfm4UyOeyu3nQCiDIcLkzRgtYsb%2B%2B431iz1DaG4lM0NG0wcM5EQ0BJrbyNPiaD7CJNlp1HuPr20WnV3ml89zcpbtBHfF4x%2BjasqtD06l8Kn%2BO%2Filjg4y%2BUaAXnyLd%2FmrnAhDgteJV%2F44Awl1ZHw0cE6PvDQq1Fsw%2Be6Ym4HzWIvRvFTSGdUqhKaYMZIclfZJUUHHhhqfbJ59cJualWNx38LRgAonOEtYOBGxWv97LBGTJ0EQU0KxLxJGsBHOZKTQuQ%2FAAwaqCwDAuRcx1cOhXBUwQhS8LTqqJQOPLYJj4r5QF8KbrnnQ1S0kNMlxGx13fpifnnAvtoZ5HfCk9sGcGpvs3jJxaCjYGAry8Ljhl65CHgQEXC5xcp1SOwNeTW%2BZhrA%3D%3D', 'Dnt': '1', 'Pragma': 'no-cache', 'Priority': 'u=0, i', 'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"', 'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Platform': '"macOS"', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'none', 'Sec-Fetch-User': '?1', 'Upgrade-Insecure-Requests': '1', 'authority': 't.livepocket.jp', 'method': 'GET', 'path': '/api/purchased_tickets/total_list?limit=10&offset=0&past=false&event_id=307219&utoken=utoken', 'scheme': 'https', } # 定义要传递给GET请求的参数字典 params = { 'limit': 10, 'offset': 0, 'utoken': 'utoken', 'past': 'false', 'event_id': 307219 } # 发送GET请求 response = requests.get(url, params=params, headers=headers) data = json.loads(response.text) print(data) def by_poc(): url = 'https://t.livepocket.jp/purchase/verify?event_id=307219' headers = { 'Accept-Encoding': 'gzip, deflate, br, zstd', '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', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Cache-Control': 'no-cache', 'Cookie': 'ci_session=TB9aP0ffcS6uK2rhcUxhb1uF8ZUaWY7oqwDg3OpGk2zZmFYAihTkYadqnniR%2FoQ7g8KCK7RXdNJ109aeJcryfm4UyOeyu3nQCiDIcLkzRgtYsb%2B%2B431iz1DaG4lM0NG0wcM5EQ0BJrbyNPiaD7CJNlp1HuPr20WnV3ml89zcpbtBHfF4x%2BjasqtD06l8Kn%2BO%2Filjg4y%2BUaAXnyLd%2FmrnAhDgteJV%2F44Awl1ZHw0cE6PvDQq1Fsw%2Be6Ym4HzWIvRvFTSGdUqhKaYMZIclfZJUUHHhhqfbJ59cJualWNx38LRgAonOEtYOBGxWv97LBGTJ0EQU0KxLxJGsBHOZKTQuQ%2FAAwaqCwDAuRcx1cOhXBUwQhS8LTqqJQOPLYJj4r5QF8KbrnnQ1S0kNMlxGx13fpifnnAvtoZ5HfCk9sGcGpvs3jJxaCjYGAry8Ljhl65CHgQEXC5xcp1SOwNeTW%2BZhrA%3D%3D', 'Dnt': '1', 'Pragma': 'no-cache', 'Priority': 'u=0, i', 'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"', 'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Platform': '"macOS"', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'none', 'Sec-Fetch-User': '?1', 'Upgrade-Insecure-Requests': '1', 'authority': 't.livepocket.jp', 'method': 'GET', 'path': '/api/purchased_tickets/total_list?limit=10&offset=0&past=false&event_id=307219&utoken=utoken', 'scheme': 'https', } response = requests.get(url, allow_redirects=False, headers=headers) if response.status_code == 302: redirect_url = response.headers['Location'] print("Redirect URL:", redirect_url) # 使用新的重定向URL再次发起请求 new_response = requests.get(redirect_url) if new_response.status_code == 200: content = new_response.text print(content) else: print('Failed to fetch the redirected page. Status code:', new_response.status_code) else: print('Initial request did not result in a redirect. Status code:', response.status_code) if __name__ == '__main__': test_poc()