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



 453

booking.flyscoot.com flight query source code

by sysdemo - 13 September, 2024 - 11:12 AM
This post is by a banned member (sysdemo) - Unhide
sysdemo  
Registered
107
Posts
24
Threads
1 Year of service
#1
I am too lazy to introduce it. Those who understand will understand it.
 
Code:
 
import base64
import requests
import json
import sys

# api config on https://www.clearcaptcha.com

main_host="http://api.clearcaptcha.com"
endpoint_hcap=main_host+"/captcha/hcaptcha_stable";
endpoint_inscap=main_host+"/captcha/incapsula_reese84_sub";
token = 'test'
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

session = requests.Session()

headers={
        "User-Agent": user_agent,
        "Accept": "application/json, text/javascript, */*; q=0.01",
        "Accept-Language": "en-US,en;q=0.5",
        "Accept-Encoding": "gzip, deflate, br, zstd",
        "Referer": "https://booking.flyscoot.com/",
        "Upgrade-Insecure-Requests": "1",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "same-origin",
        "Sec-Fetch-User": "?1",
        "Connection": "keep-alive",
    }

response = session.get("https://booking.flyscoot.com/Book/Flight?culture=en-US&type=oneway&dst1=SIN&ast1=CAN&dst2=CAN&ast2=SIN&dd=2024-09-13&rd=null&adt=1&chd=0&inf=0",headers=headers,verify=False)

jsurl="https://booking.flyscoot.com/amisu-It-should-drun-the-very-Donall-wift-the-Wi/16297114608146132505?s=f60ccUGy"
post_data = {
    "token": token,
    "jsurl": jsurl,
    "user_agent": user_agent,
}

response = requests.post(endpoint_inscap, data=post_data)
if response.status_code != 200:
    print({"error": "api error","status_code": response.status_code,"response": response.text})
    sys.exit()

response_data=response.json()
if response_data['code']!=200:
    print(response.text)
    sys.exit()

post_data=response_data['data']['post_data']
headers["Content-Type"]="text/plain; charset=utf-8"
response = requests.post("https://booking.flyscoot.com/amisu-It-should-drun-the-very-Donall-wift-the-Wi/16297114608146132505?d=booking.flyscoot.com", data=post_data,headers=headers,verify=False)
if response.status_code != 200:
    print({"error": "api error","status_code": response.status_code,"response": response.text})
    sys.exit()
response_data = response.json()
reese84=response_data['token']
session.cookies.set("reese84", reese84,domain="flyscoot.com",path="/")

post_data='"'+reese84+'"'
response = requests.post("https://booking.flyscoot.com/xildrong-in-I-confusing-freene-of-Duncannothin-b?d=booking.flyscoot.com", data=post_data,headers=headers,verify=False)
if response.status_code != 200:
    print({"error": "api error","status_code": response.status_code,"response": response.text})
    sys.exit()
response_data = response.json()
reese84=response_data['token']
session.cookies.set("reese84", reese84,domain="flyscoot.com",path="/")

headers["Content-Type"]="application/json"
headers["X-Scoot-AppSource"]="IBE-WEB"
headers["X-Scoot-Client-Environment"]="PROD"
headers["X-Scoot-Client-Session"]="3cf8743c-2aa3-4bdc-b9ec-3d47531b0c15"
headers["X-Scoot-Client-Version"]="0.0.0"

response=session.get("https://booking.api.flyscoot.com/v1/account/anonymous",headers=headers,verify=False)
if response.status_code != 200:
    print({"error": "api error","status_code": response.status_code,"response": response.text})
    sys.exit()
response_data = response.json()
authorization=response_data['data']['accessToken']

post_data = {
    "token": token,
    "referer": "https://booking.flyscoot.com",
    "sitekey": "81e02ccc-8862-41be-a7fe-c3f04ba0eb8c",
    "user_agent": user_agent,
    "is_invisible": True,
}

max_retries = 10 
retry_count = 0 
while retry_count < max_retries:
    response = requests.post(endpoint_hcap, data=post_data, verify=False)

    if response.status_code != 200:
        print({"error": "api error", "status_code": response.status_code, "response": response.text})
        sys.exit()

    response_data = response.json()

    if response_data['code'] != 200:
        print("Retrying request due to error:", response.text)
        retry_count += 1
        continue  
    else:
        print("Request successful!")
        break  
if retry_count == max_retries:
    print("Maximum retry attempts reached. Exiting.")
    sys.exit()
    
generated_pass_UUID=response_data['data']['generated_pass_UUID']
#user_agent=response_data['data']['user_agent']


post_data = '{"flightCriteria":[{"origin":"SIN","destination":"CAN","departureDate":"2024-10-13"}],"passengerCriteria":{"adult":1,"child":0,"infant":0},"currencyCode":"SGD","promoCode":"","salesCode":null,"flightFare":{"fareType":[],"productClass":["E1","E2","E3","E4","E5","J","P4","J4"],"classOfService":[],"maxConnections":20},"sortingOptions":["LowestFare","ShortestTravelTime","EarliestArrival"],"cultureCode":"en-us","bundleControlFilter":2,"ssrs":["FLXO","FLXM","FLXR"],"txnToken":"'+generated_pass_UUID+'"}'



headers["User-Agent"]=user_agent
headers["Authorization"]=authorization

response = session.post("https://booking.api.flyscoot.com/flights/availability",data=post_data,headers=headers,verify=False)
print(response.text)
This post is by a banned member (sysdemo) - Unhide
sysdemo  
Registered
107
Posts
24
Threads
1 Year of service
Bumped #2
This is a bump
This post is by a banned member (sysdemo) - Unhide
sysdemo  
Registered
107
Posts
24
Threads
1 Year of service
Bumped #3
This is a bump

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 3 Guest(s)