🧠 An automated flight scraping tool powered by Puppeteer to extract real-time data from Google Flights.
- 🔍 Customizable flight search (origin, destination, dates)
- 🧭 Headless browser automation using Puppeteer
- 💾 Outputs structured JSON data
✈️ Captures airline, duration, price, stops, and more- 🔐 No API required – scrapes live data directly
GFlightScraper/
├── scraper/ # Core Puppeteer scraping logic
├── fileHandler/ # JSON file handling
├── utils/ # Helper utilities
├── main.js # Main script
├── package.json # Project dependencies
└── README.md # Documentation
# 1. Clone this repository
git clone https://github.com/Faheem798/GFlightScraper.git
# 2. Move into the project folder
cd GFlightScraper
# 3. Install required packages
npm install- ✍️ Add your Google Flights links in
utils/data.jslike this:
module.exports = [
"https://www.google.com/travel/flights/search?tfs=...&tfu=...",
"https://www.google.com/travel/flights/search?tfs=...&tfu=...",
// Add more links as needed
];▶️ Run the script:
node main.js- ✅ Check your output:
The scraped data will be saved in the output/ folder as a .json file.
[
{
"airline": "Qatar Airways",
"price": "$420",
"departureTime": "02:45 AM",
"arrivalTime": "10:25 AM",
"duration": "7h 40m",
"stops": "1 stop"
}
]- To see browser activity, launch Puppeteer in non-headless mode:
puppeteer.launch({ headless: false });- If selectors stop working, inspect the DOM and update the scraping logic accordingly.
Contributions are welcome! 🙌
# Create a new feature branch
git checkout -b feature/your-feature
# Commit your changes
git commit -m "Add awesome feature"
# Push and create a pull request
git push origin feature/your-featureThis project is licensed under the MIT License.
Made with ❤️ by Faheem
Got questions or suggestions? Open an issue
⚠️ Disclaimer: Google Flights may change its layout or block automated access. Use this tool responsibly and for educational purposes only.