Scraper for Skyscanner. My main purpose was to automate searching for the cheapest flight between a flexible range of dates.
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.
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; }; }; }
Make sure you have Node.js installed first.
- Run install.sh. This will temporarily open two Terminal windows.
- Run install.bat. This will temporarily open two Command Prompt windows.
- Run start.sh. This will open two Terminal windows.
- Open http://localhost:3000/
- When you're done, go to each of the Terminal windows, then press
Control^ + C
to terminate.
- Run start.bat. This will open two Command Prompt windows.
- Open http://localhost:3000/
- 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)
- Search by airport name
- Form validation
- Backend caching
- Responsive design