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

Jump to content



Photo

BOOKING.FLYSCOOT.COM FLIGHT QUERY SOURCE CODE


  • Please log in to reply
BOOKING.FLYSCOOT.COM FLIGHT QUERY SOURCE CODE

#1

sysdemo
sysdemo
    Offline
    0
    Rep
    0
    Likes

    Member

Posts: 25
Threads: 14
Joined: Jul 23, 2024
Credits: 0
#1

I am too lazy to introduce it. Those who understand will understand it.

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)


  • 0

#2

GraySec
GraySec
    Online
    0
    Rep
    3
    Likes

    New Member

Posts: 16
Threads: 1
Joined: Mar 28, 2024
Credits: 0

Half year registered
#2

Interesting.

 

For those who don't understand what the script does, it appears to be a "scraper"-like script for flight info from what I can see.

 

I apologize if I am wrong.

 

Thank you for this interesting and educational post.  :)


Edited by GraySec, 17 September 2024 - 03:00 AM.

  • 0


 Users browsing this thread: and 1 guests