ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Other languages

stubhub.com ticket and seat check source code demo open source

Submitted by sysdemo at 17-11-2024, 08:54 AM


stubhub.com ticket and seat check source code demo open source
2.912 Views
sysdemo's Avatar'
sysdemo
Offline
#1
Check the remaining tickets and seat numbers according to the ticket link (https://www.stubhub.com/eagles-las-vegas...154478546/)

[ Hidden Content! ]

Code:
from math import fabs
from weakref import proxy
import requests
import json
import sys
import random
import string
import re
import urllib


# captcha api config on https://www.clearcaptcha.com
akamai_api="http://api.clearcaptcha.com/captcha/akamai_v2";
tls_api="http://api.clearcaptcha.com/captcha/tls";
token = 'test' # need replace your clearcaptcha token
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
proxy="dc.proxiware.com:8080:user-test-us:test123456"  # need replace your proxy

def tls_result(url,method,headers,body,user_agent,proxy, cookie="", redirect=True):
    
    data = {
        'token': token,
        'method': method,
        'url': url,
        'headers': json.dumps(headers),
        'body': body,
        'user_agent': user_agent,
        'proxy': proxy,
        'cookie': cookie,
        'allow_redirect': str(redirect).lower()
    }
    
    proxies = None
    if proxy:
        proxies = {
            'http': proxy,
            'https': proxy
        }
    try:
        response = requests.post(tls_api, data=data, proxies=proxies, allow_redirects=redirect)
        return response.json()
    except requests.RequestException as e:
        print(str(e))
        sys.exit()
    
def akamai_result(abck, bm_sz, website, ua_ver="129.0.0.0"):
    data = {
        'token': token,
        'abck': abck,
        'bm_sz': bm_sz,
        'website': website,
        'ua_ver': ua_ver
    }
    try:
        response = requests.post(akamai_api, data=data)
        return response.json()
    except requests.RequestException as e:
        print(str(e))
        sys.exit()




session = requests.Session()
headers={
        'Connection': 'keep-alive',
        'User-Agent': user_agent,
        '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': 'en-US,en;q=0.5',
        'Accept-Encoding': 'gzip, deflate, br',
        'Referer': 'https://www.stubhub.com/',
        'Origin': 'https://www.stubhub.com',
        'sec-ch-ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'Sec-Fetch-Dest': 'document',
        'Sec-Fetch-Mode': 'navigate',
        'Sec-Fetch-Site': 'same-origin',
        'Sec-Fetch-User': '?1',
        'Upgrade-Insecure-Requests': '1',
    }

response_data = tls_result("https://www.stubhub.com/eagles-las-vegas-tickets-1-18-2025/event/154478546/?", "GET", headers, "", user_agent, proxy, "");

response_html = response_data["data"]["result"]
cookies = response_data["data"]["cookie"]

cookie_str = ''.join(cookies)

abck_match = re.search(r"_abck=(.*?);", cookie_str)
bm_sz_match = re.search(r"bm_sz=(.*?);", cookie_str)
abck = abck_match.group(1) if abck_match else None
bm_sz = bm_sz_match.group(1) if bm_sz_match else None

response_data = akamai_result(abck, bm_sz, "https://www.stubhub.com/", "129.0.0.0");
sensor_data = response_data["data"]["sensor_data"];
ua = response_data["data"]["ua"];



headers["User-Agent"]=ua
headers["Content-Type"]="text/plain;charset=UTF-8"

post_data={
    "sensor_data": sensor_data,
}
post_data=json.dumps(post_data)
response_data = tls_result("https://www.stubhub.com/PinUltr2/N26jcFy/UIU9pxd/p_/Guf7bGVD7r4LL9/Qk1QICEi/eCkp/FCZ9OHIB", "POST", headers, post_data, user_agent, proxy, cookie_str);
response_html = response_data["data"]["result"]
cookies = response_data["data"]["cookie"]
if '{"success": true}' not in response_html:
    print('akamai verification failed!')
    sys.exit()
print('akamai verification successfully!')

cookie_str = ''.join(cookies)

headers["Content-Type"]="application/json"

post_data='{"ShowAllTickets":true,"HideDuplicateTicketsV2":false,"Quantity":2,"IsInitialQuantityChange":false,"PageVisitId":"A382086B-C196-4D66-BDB3-107EBD26CB72","PageSize":20,"CurrentPage":1,"SortBy":"NEWPRICE","SortDirection":0,"Sections":"","Rows":"","Seats":"","SeatTypes":"","TicketClasses":"","ListingNotes":"","PriceRange":"0,100","InstantDelivery":false,"EstimatedFees":false,"BetterValueTickets":true,"PriceOption":"","HasFlexiblePricing":false,"ExcludeSoldListings":false,"RemoveObstructedView":false,"NewListingsOnly":false,"PriceDropListingsOnly":false,"SelectBestListing":false,"ConciergeTickets":false,"Method":"IndexSh"}'
response_data = tls_result("https://www.stubhub.com/eagles-las-vegas-tickets-1-18-2025/event/154478546/", "POST", headers, post_data, user_agent, proxy, cookie_str);
response_html = response_data["data"]["result"]
if '"items":' in response_html:
    item_json=json.loads(response_html)
    print(f'Get data successfully! current page: {item_json["currentPage"]}, total count: {item_json["totalCount"]}')
else:
    print(f'Failed to get data! {response_html}')

0
Reply


Messages In This Thread
stubhub.com ticket and seat check source code demo open source - by sysdemo - 17-11-2024, 08:54 AM


Users browsing this thread: