Skip to content

Latest commit

 

History

History
133 lines (90 loc) · 2.83 KB

File metadata and controls

133 lines (90 loc) · 2.83 KB

✈️ GFlightScraper

GitHub top language GitHub repo size Node.js

🧠 An automated flight scraping tool powered by Puppeteer to extract real-time data from Google Flights.


📦 Features

  • 🔍 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

📁 Project Structure

GFlightScraper/
├── scraper/         # Core Puppeteer scraping logic
├── fileHandler/     # JSON file handling
├── utils/           # Helper utilities
├── main.js          # Main script
├── package.json     # Project dependencies
└── README.md        # Documentation

🛠️ Installation

# 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

🚀 How to Use

  1. ✍️ Add your Google Flights links in utils/data.js like 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
];
  1. ▶️ Run the script:
node main.js
  1. Check your output:

The scraped data will be saved in the output/ folder as a .json file.


📄 Sample Output

[
  {
    "airline": "Qatar Airways",
    "price": "$420",
    "departureTime": "02:45 AM",
    "arrivalTime": "10:25 AM",
    "duration": "7h 40m",
    "stops": "1 stop"
  }
]

🧪 Development Tips

  • 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.

🤝 Contributing

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-feature

📄 License

This project is licensed under the MIT License.


💬 Contact

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.