buy_poc.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import json
  2. import time
  3. import requests
  4. def test_poc():
  5. url = 'https://t.livepocket.jp/api/purchased_tickets/total_list'
  6. headers = {
  7. 'Accept-Encoding': 'gzip, deflate, br, zstd',
  8. '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',
  9. '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',
  10. 'Accept-Language': 'zh-CN,zh;q=0.9',
  11. 'Cache-Control': 'no-cache',
  12. 'Cookie': 'ci_session=TB9aP0ffcS6uK2rhcUxhb1uF8ZUaWY7oqwDg3OpGk2zZmFYAihTkYadqnniR%2FoQ7g8KCK7RXdNJ109aeJcryfm4UyOeyu3nQCiDIcLkzRgtYsb%2B%2B431iz1DaG4lM0NG0wcM5EQ0BJrbyNPiaD7CJNlp1HuPr20WnV3ml89zcpbtBHfF4x%2BjasqtD06l8Kn%2BO%2Filjg4y%2BUaAXnyLd%2FmrnAhDgteJV%2F44Awl1ZHw0cE6PvDQq1Fsw%2Be6Ym4HzWIvRvFTSGdUqhKaYMZIclfZJUUHHhhqfbJ59cJualWNx38LRgAonOEtYOBGxWv97LBGTJ0EQU0KxLxJGsBHOZKTQuQ%2FAAwaqCwDAuRcx1cOhXBUwQhS8LTqqJQOPLYJj4r5QF8KbrnnQ1S0kNMlxGx13fpifnnAvtoZ5HfCk9sGcGpvs3jJxaCjYGAry8Ljhl65CHgQEXC5xcp1SOwNeTW%2BZhrA%3D%3D',
  13. 'Dnt': '1',
  14. 'Pragma': 'no-cache',
  15. 'Priority': 'u=0, i',
  16. 'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
  17. 'Sec-Ch-Ua-Mobile': '?0',
  18. 'Sec-Ch-Ua-Platform': '"macOS"',
  19. 'Sec-Fetch-Dest': 'document',
  20. 'Sec-Fetch-Mode': 'navigate',
  21. 'Sec-Fetch-Site': 'none',
  22. 'Sec-Fetch-User': '?1',
  23. 'Upgrade-Insecure-Requests': '1',
  24. 'authority': 't.livepocket.jp',
  25. 'method': 'GET',
  26. 'path': '/api/purchased_tickets/total_list?limit=10&offset=0&past=false&event_id=307219&utoken=utoken',
  27. 'scheme': 'https',
  28. }
  29. # 定义要传递给GET请求的参数字典
  30. params = {
  31. 'limit': 10,
  32. 'offset': 0,
  33. 'utoken': 'utoken',
  34. 'past': 'false',
  35. 'event_id': 307219
  36. }
  37. # 发送GET请求
  38. response = requests.get(url, params=params, headers=headers)
  39. data = json.loads(response.text)
  40. print(data)
  41. def by_poc():
  42. url = 'https://t.livepocket.jp/purchase/verify?event_id=307764'
  43. headers = {'Content-Type': 'application/x-www-form-urlencoded;',
  44. 'Accept-Encoding': 'gzip, deflate, br, zstd',
  45. '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',
  46. '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',
  47. }
  48. response = requests.get(url, allow_redirects=False, headers=headers)
  49. if response.status_code == 302:
  50. redirect_url = response.headers['Location']
  51. print("Redirect URL:", redirect_url)
  52. # 使用新的重定向URL再次发起请求
  53. new_response = requests.get(redirect_url)
  54. if new_response.status_code == 200:
  55. content = new_response.text
  56. print(content)
  57. else:
  58. print('Failed to fetch the redirected page. Status code:', new_response.status_code)
  59. else:
  60. print('Initial request did not result in a redirect. Status code:', response.status_code)
  61. if __name__ == '__main__':
  62. test_poc()