A comprehensive flight price monitoring tool that scrapes Google Flights for Copenhagen (CPH) to Antalya (AYT) flights using NordVPN to compare prices from different geographic locations.
This script automatically:
- Connects to multiple NordVPN countries to simulate browsing from different locations
- Scrapes Google Flights for direct/nonstop flights from Copenhagen to Antalya
- Forces EUR currency for consistent price comparison across all locations
- Captures screenshots of flight results from each country
- Extracts flight prices and saves them to CSV files
- Generates consolidated reports comparing prices across all tested countries
- Route: Copenhagen (CPH) β Antalya (AYT)
- Dates: October 17-24, 2025 (7-day trip)
- Filter: Direct/nonstop flights only
- Currency: EUR (forced via URL parameter)
- Python 3.8+
- Chrome browser
- NordVPN subscription and CLI (mandatory - no fallback option)
- Git (for cloning)
This script requires NordVPN to be installed and configured:
- Install NordVPN CLI
- Log in to your NordVPN account:
nordvpn login - Verify connection:
nordvpn countries
git clone <repository-url>
cd flights
# Make setup script executable and run it
chmod +x setup_venv.sh
./setup_venv.sh
# Activate virtual environment
source flights_venv/bin/activatepython copenhagen_antalya_scraper.pyThe script generates organized output files:
screenshots/
βββ Copenhagen_to_Antalya_from_20251017_to_20251024_Afghanistan.png
βββ Copenhagen_to_Antalya_from_20251017_to_20251024_Germany.png
βββ Copenhagen_to_Antalya_from_20251017_to_20251024_Australia.png
prices/
βββ Copenhagen_to_Antalya_direct_Afghanistan.csv
βββ Copenhagen_to_Antalya_direct_Germany.csv
βββ Copenhagen_to_Antalya_direct_Australia.csv
βββ Copenhagen_to_Antalya_consolidated_prices.csv # Combined results
Each CSV contains:
- Country: VPN location used
- Airline: Flight carrier
- Price: Flight price (preferably in EUR)
- Departure/Arrival: Times (see screenshot for details)
- Duration: Flight duration (see screenshot)
- Stops: Always "Nonstop" (filtered)
- Country Discovery: Script queries
nordvpn countriesto get available locations - Sequential Connection: Connects to each country one by one
- Clean Browser Sessions: Creates fresh Chrome instance for each country
- Price Extraction: Scrapes flight data with location-specific pricing
- Automatic Cleanup: Disconnects VPN and cleans temporary files
- Forces EUR via URL parameter:
&curr=EUR - Looks for prices in format:
β¬1,234,EUR 1234,1234 β¬ - Price range validation: β¬100 - β¬10,000
If EUR not found, tries:
- USD: $50 - $5,000
- GBP: Β£50 - Β£4,000
- DKK: 400 - 35,000 DKK
- AFN: 5,000 - 500,000 AFN (Afghanistan)
- kr: 500 - 50,000 kr (Nordic countries)
- Headless Chrome with stealth options
- Consent page handling for GDPR compliance
- Nonstop filter application via DOM manipulation
- Currency selection with confirmation button clicking
- Unique temp directories for each country session
- Complete session isolation to prevent cross-contamination
- Automatic cleanup of temporary Chrome data
- Robust VPN connection with retry logic
- Screenshot capture on errors for debugging
- Graceful failure - continues with next country if one fails
- Comprehensive logging of all operations
selenium>=4.0.0
webdriver-manager>=3.8.0
pandas>=1.5.0
Install via: pip install -r requirements.txt
NordVPN Not Available
ERROR: No NordVPN countries available. NordVPN is required for this script.
Please ensure NordVPN is installed and you are logged in.
Solution: Install NordVPN CLI and login with nordvpn login
Chrome Driver Issues
- Script auto-downloads ChromeDriver via webdriver-manager
- Ensure Chrome browser is installed and up-to-date
No Prices Found
- Check screenshots in
screenshots/folder for visual debugging - Verify Google Flights is accessible from your location
- Some countries may have different Google Flights interfaces
- Screenshots: Visual confirmation of what the script sees
- Temp directories: Cleaned automatically but preserved on errors
- Console output: Detailed logging of each step
Edit the get_nordvpn_countries() function to filter specific countries:
return unique_countries[:5] # Test only first 5 countriesUpdate the main() function:
origin = "Copenhagen" # Change departure city
destination = "Antalya" # Change destination
depart_date = "2025-10-17" # Change departure date
return_date = "2025-10-24" # Change return dateModify validation ranges in extract_flight_prices() function.
- Price comparison across different geographic markets
- Travel deal hunting by leveraging regional pricing differences
- Market research for flight pricing strategies
- Automated monitoring of specific route pricing trends
- Respect robots.txt and website terms of service
- Rate limiting built-in with delays between requests
- Personal use - not for commercial scraping at scale
- VPN usage complies with NordVPN terms of service
- Fork the repository
- Create a feature branch
- Make your changes
- Test with multiple VPN locations
- Submit a pull request
Note: This script is designed for personal travel research and price comparison. Always verify prices on official airline websites before booking.