Categorygithub.com/antodippo/flight-scraper
repositorypackage
0.0.0-20230531163708-b90e9bc9a5e4
Repository: https://github.com/antodippo/flight-scraper.git
Documentation: pkg.go.dev

# README

Flight scraper

Build Release Go Report License: MIT

It's a simple flight prices scraper written in Go. Given a route and a date, it's gonna query Kayak.com website, parse the page, and send the information to the provided email recipient.

The simplest way to use it is to download it for your operating system and run:

$ ./flight-scraper -departure=FCO -arrival=AMS -date=2020-06-15 [email protected],[email protected]

where:

  • departure and arrival are IATA airport codes
  • date is in YYYY-MM-DD format
  • recipient is the email recipient

At the moment you also need to set up an email SMTP server, adding the environment variables in the .env file.

Use the .env.dist file as a reference:

SMTP_FROM="Flights scraper <[email protected]>"
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=myusername
SMTP_PWD=mypassword

This is similar to what you get as a result in your email:

RouteTimeAirlinePrice
FCO - AMS15:30 - 18:00easyJet76€
FCO - AMS10:30 - 13:05LEVEL81€
FCO - AMS19:35 - 22:10LEVEL97€
FCO - AMS8:35 - 11:05Alitalia109€
FCO - AMS14:05 - 16:35Alitalia109€
FCO - AMS6:30 - 8:50KLM143€
FCO - AMS19:40 - 22:05KLM143€
FCO - AMS12:40 - 15:10KLM143€
FCO - AMS10:20 - 12:55KLM143€
FCO - AMS17:25 - 20:00KLM143€

A possible use is to run it as a cron job, so you get flight prices in your inbox every chosen amount of time.

This was build just for learning and experimentation purposes, before using it please read Kayak.com terms and conditions.