Scraping flight data from Google Flights and analyzing.
Project description
Flight Analysis
This project provides tools and models for users to analyze, forecast, and collect data regarding flights and prices. There are currently many features in initial stages and in development. The current features (as of 4/5/2023) are:
- Scraping tools for Google Flights
- Base analytical tools/methods for price forecasting/summary
The features in development are:
- Models to demonstrate ML techniques on forecasting
- API for access to previously collected data
Table of Contents
Overview
Flight price calculation can either use newly scraped data (scrapes upon running it) or cached data that reports a price-change confidence determined by a trained model. Currently, many features of this application are in development.
Usage
The web scraping tool is currently functional only for scraping round trip flights for a given origin, destination, and date range. It can be easily used in a script or a jupyter notebook.
Note that the following packages are absolutely required as dependencies:
- tqdm
- selenium (make sure to update your ChromeDriver!)
- pandas
- numpy
You can easily install this by running either installing the Python package google-flight-analysis
:
pip install google-flight-analysis
or forking/cloning this repository. Upon doing so, make sure to install the dependencies and update ChromeDriver to match your Google Chrome version.
pip install -r requirements.txt
The main scraping function that makes up the backbone of most other functionalities is Scrape()
. It serves also as a data object, preserving the flight information as well as meta-data from your query. For Python package users, import as follows:
from google_flight_analysis.scrape import *
For GitHub repository cloners, import as follows from the root of the repository:
from src.google_flight_analysis.scrape import *
Here is some quick starter code to accomplish the basic tasks. Find more in the documentation.
# Try to keep the dates in format YYYY-mm-dd
result = Scrape('JFK', 'IST', '2022-05-20', '2022-06-10') # obtain our scrape object
dataframe = result.data # outputs a Pandas DF with flight prices/info
origin = result.origin # 'JFK'
dest = result.dest # 'IST'
date_leave = result.date_leave # '2022-05-20'
date_return = result.date_return # '2022-06-10'
Updates & New Features
Performing a complete revamp of this package, including new addition to PyPI. Documentation is being updated frequently, contact for any questions.
Real Usage
Here are some great flights I was able to find and actually booked when planning my travel/vacations:
- NYC ➡️ AMS (May 9), AMS ➡️ IST (May 12), IST ➡️ NYC (May 23) | Trip Total: $611 as of March 7, 2022
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file google-flight-analysis-1.0.0.tar.gz
.
File metadata
- Download URL: google-flight-analysis-1.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46edb18a1f6c79b5f74683920998ea9401bd13b6fe30b25c55421301915b30d |
|
MD5 | e77f9d7cf54666632c59eb95e78f7d3b |
|
BLAKE2b-256 | a98cef64538c4ddeff552470647bdf74bf05e7199844376cb778fe7123fc4ab5 |
File details
Details for the file google_flight_analysis-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: google_flight_analysis-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9053272b5255fe40a912a7e708da005588e70507ce545b6945457b2f64280cc |
|
MD5 | 7c269c7374ea122ee60b4ca4a709af1b |
|
BLAKE2b-256 | ce9f12f673337363b4cb13c22e4e79689cfcf9ee1fa3623b5d371f8abb58be39 |