Buy cheaper plane tickets using a VPN: truth or myth?
Debunking the myth of different ticket prices from different countries
July is the Smartproxy month on The Web Scraping Club. For the whole month, following this link, you can use the discount code SPECIALCLUB and get a massive 50% off on any proxy and scraper subscription.
The summer holiday season started and, on Tik Tok, Youtube, and other media, just like every year, there’s an article or a video regarding tricks on how to save money when booking a flight.
Common sense apart, like booking earlier and trying different days to see what’s the cheapest combination of dates, there’s always a travel guru saying “I’ve discovered trick airlines don’t want you to know! Using a VPN and cleaning your cookies every time (just to give all this nonsense a hacker-ish appearance), you can simulate connecting by different countries and get a better ticket price! Oh yes, and here’s my affiliate link for VPN X, Y, and Z”
Nothing against the content creator in particular, and as you can see I use affiliate links too, for services that can be useful for the community and they are usually matched with a discount code, so it’s a win-win for everyone.
I’ve heard this trick for years and for sure also airlines did it too. Maybe years ago this worked, but it was a glitch solved as soon as it was exploited. But we can use this experiment to exercise with Playwright and the usage of proxies in it.
Checking ticket prices with Playwright and proxies
As usual, the code is available on the GitHub repository available to paying readers. If you’re one of them but don’t have access, please write me at pier@thewebscraping.club. I manually need to enable the accesses and I need to know your GitHub username.
We’ll check the prices on the website of British Airways, which is protected by Akamai, using Playwright and integrating residential proxies from Smartproxy.
I want to check all the flights from London to New York available for the 12th of August.
This implies several interactions with the website's UX, selecting dates and airports, and a simple Scrapy spider it’s not enough.
We’re not interested in downloading data but only having a look at it, just to check if the prices change from country to country of connection.
First run, no proxy
As a first run, I’ll use Brave Browser with Playwright and, as I’m running the script from Italy, I’ve been redirected to the Italian version of the website.
Technically, after clicking for agreeing on cookie collection, we can access the website and type in the form the departure airport, and the destination and select the date.
We’re using the page.type function to write data in the form, while page.click with XPath selectors for the navigation of the website.
As a result, we see that all the prices are 2.092 pounds for the economy class.
Let’s see if something changes if we add a proxy and connect from the USA.
Second run, connecting from the USA
In this case, I’ve added the proxy configuration in the browser call, and, depending on the input country of the script, I connect to a different endpoint of the Smartproxy residential proxies.
But the result is the same as before, with the same price for the same flights.
Let’s try connecting from the United Kingdom, the home country of the company.
Third run, connecting from the GBR
Added a new country in our proxy setup, the result is the same.
Again the same prices as the previous runs, so we can say that our job as a debunker finished here.
A real use case for proxies
Jokes apart, there are many cases, from social media scraping to online advertising monitoring which needs a proxy solution where it’s possible to choose the country of the IP.
Keep reading with a 7-day free trial
Subscribe to The Web Scraping Club to keep reading this post and get 7 days of free access to the full post archives.