Python package to scrape flight data from Google Flights and analyzes prices. Can determine optimal flight from date, place, and price
Last updated Jun 24, 2026
183
Stars
46
Forks
15
Issues
0
Stars/day
Attention Score
84
Language breakdown
Python 100.0%
▸ Files
click to expand
README
Flight Analysis
A Python package for scraping flight data from Google Flights and analyzing flight prices.
Features
- Scrape flight data from Google Flights (round-trip, one-way, multi-city)
- Store in SQLite database for historical analysis
- CLI interface for agents and automation
- Price history tracking and analysis
- Scheduled scraping via GitHub Actions
Installation
pip install google-flight-analysis
Or for development:
git clone https://github.com/celebi-pkg/flight-analysis
cd flight-analysis
pip install -e .
Requirements
- Python 3.8+
- Chrome/Chromium browser
- ChromeDriver (auto-installed)
Quick Start
CLI Usage
# Get current price for a route
flight-cli price JFK LAX -d 2026-06-01
Scrape and store flight data
flight-cli scrape JFK LAX -d 2026-06-01
Database operations
flight-cli db init
flight-cli db routes
flight-cli db history JFK LAX --days 30
Python API
from googleflightanalysis import scrape, get_db
Scrape flights
result = scrape("JFK", "LAX", "2026-06-01")
print(result.data) # pandas DataFrame
Save to database
result.savetodb()
Query price history
db = get_db()
history = db.getpricehistory("JFK", "LAX", days=30)
Available Commands
| Command | Description | |---------|-------------| | price | Get current flight prices | | scrape | Scrape and store flight data | | db | Database operations (init, info, routes, history) | | analyze | Analyze prices, find best buy day | | recommend | Recommend best flight option |
Options
--json- JSON output for agents--date,-d- Departure date (YYYY-MM-DD)--return-date,-r- Return date for round-trip--trip-type- one-way or round-trip
Configuration
Configuration is managed via environment variables or Python:
from googleflightanalysis import config
config.chrome.wait = 15 # seconds config.db.path = "/path/to/flights.db"
Environment variables:
FLIGHTDBPATH- Database pathFLIGHTCACHEDIR- Cache directory
Architecture
googleflightanalysis/
├── scrape/ # Scraping logic
│ ├── driver.py # ChromeDriver wrapper
│ └── scrape.py # Scrape class
├── db/ # Database
│ ├── models.py # SQLAlchemy models
│ └── database.py # Database class
├── cli/ # CLI interface
├── legacy/ # Legacy components (fallback)
└── config.py # Configuration
Testing
pytest tests/ -v
Contributing
- Fork the repository
- Create a feature branch
- Make changes and add tests
- Submit a PR
License
MIT License - see LICENSE file.
🔗 More in this category