Skip to content

AlexisN94/Skyscraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skyscraper

Scraper for Skyscanner. My main purpose was to automate searching for the cheapest flight between a flexible range of dates.

Screenshots

Frontend

You can specify an origin and a destination (by aiport codes, which you can easily find on Google), a range of dates to fly within and a minimum and maximum number of nights to stay at your destination. You can also search one-way and weekend-only flights.

For example, if you want to travel between 1/Aug and 8/Aug and want to stay between 5 to 7 nights, the app will search for the cheapest flight on each of the possible dates:

  1/Aug - 6/Aug (5 nights)
  2/Aug - 7/Aug (5 nights)
  3/Aug - 8/Aug (5 nights)
  1/Aug - 7/Aug (6 nights)
  2/Aug - 8/Aug (6 nights)
  1/Aug - 8/Aug (7 nights)

You can sort the results by price (default), average flight duration, stay duration, departure date, return date, number of stops and number of different airlines.

You might be occasionally prompted by Skyscanner to complete CAPTCHAs.

Backend

The only endpoint is /flights and it requires an url parameter.
E.g. http://localhost:4001/flights?url=https://www.skyscanner.pt/transport/flights/opo/hkg/230114/230122/

Response model
{
  noFlights: boolean;
  doingCaptcha?: boolean;
  noInternet?: boolean;
  bestFlight?: {
    avgDuration: string;
    price: number;
    outboundSegment: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
    inboundSegment?: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
  };
  cheapestFlight?: {
    avgDuration: string;
    price: number;
    outboundSegment: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
    inboundSegment?: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
  };
  fastestFlight?: {
    avgDuration: string;
    price: number;
    outboundSegment: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
    inboundSegment?: {
      origin: string;
      destination: string;
      duration: string;
      departureTime: string;
      arrivalTime: string;
      stops: string[];
      airlines: string[];
      timeOffset?: string;
    };
  };
}

To install

Make sure you have Node.js installed first.

Unix:

  • Run install.sh. This will temporarily open two Terminal windows.

Windows:

  • Run install.bat. This will temporarily open two Command Prompt windows.

To run

Unix:

  1. Run start.sh. This will open two Terminal windows.
  2. Open http://localhost:3000/
  3. When you're done, go to each of the Terminal windows, then press Control^ + C to terminate.

Windows:

  1. Run start.bat. This will open two Command Prompt windows.
  2. Open http://localhost:3000/
  3. When you're done, go to each of the Command Prompt windows, then press Ctrl + C (you might need to press twice on one of the windows)

TODO

  • Search by airport name
  • Form validation
  • Backend caching
  • Responsive design

About

Skyscanner scraper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published