



























Travel trends can change dramatically depending on the season, major events, weather patterns, and social media buzz. If you have a travel app and need to recommend destinations, plan seasonal promotions, or understand where traveler interest is growing, Google Trends can provide valuable insights into what places are capturing attention right now.
In this tutorial, we'll use SerpApi's Google Trends API to compare travel destinations, identify rising locations, and uncover seasonal travel patterns using Python.
If you are new to SerpApi get started with this blog post:
Getting started with SerpApi: The Web Search API
Learn what SerpApi is, how to use it, and why you need it.
SerpApiHilman Ramadhan

Now that you are setup with SerpApi and have located your API key, let's take a look at SerpApi's libraries.
In this example we will be using SerpApi's Python library.
To install the serpapi package, simply run the following command:
$ pip install serpapiYou can also make a simple GET request or for other programming languages, view our supported libraries here: https://serpapi.com/integrations.
Using a set list of popular travel destinations, we are going to use SerpApi's Google Trends API to compare the travel destinations popularity of what's trending now.
Within the Google Trends API there are a max of 5 keywords you can compare at once. The values are shown on a range of 0 to 100. These are not a set range across keywords, they show interest relative to the highest term including in the keywords. You can read more about this here:
Google Trends Numbers: From 0 to 100, What is it?
Understand how Google Trends data numbers are adjusted. What does the value of 0 to 100 mean?
SerpApiHilman Ramadhan

This means we will have to have an anchor where the highest ranking item will be compared to the next 4 items.
Having all countries compared to the most popular country mean some of the countries may tie with each other (i.e avg of 1 for 4 countries). Additional logic comparing those tied countries against each other will get the final ranking.
There are more parameters available on the Google Trends API, however these are the parameters we will be using.
cat: Category filter, we will be setting this parameter to 67 for "travel". Full list heretz: We'll be setting the timezone offset. This will be the UTC offset * 60 * -1"tz": "420"date: You can set this to past hrs, days, years"date": "2026-05-01 2026-05-31"engine: Specify the search engine you want to use"engine": "google_trends"api_key: Your secret API key found here"api_key": "YOUR_SECRET_API_KEY"COUNTRIES listmain()COUNTRIESq call_serpapi()country_results dictcountry_results by average, descending, into sorted_resultsget_top_ten()call_serpapi with tied countries import serpapi
# Set travel countries we want to compare
COUNTRIES = ["United States", "Canada", "Mexico", "Costa Rica", "Dominican Republic", "Jamaica", "Bahamas", "Brazil", "Argentina", "Peru", "Chile", "Colombia", "United Kingdom", "Ireland", "France", "Spain", "Portugal", "Italy", "Greece", "Netherlands", "Belgium", "Germany", "Switzerland", "Austria", "Czech Republic", "Hungary", "Croatia", "Poland", "Iceland", "Norway", "Sweden", "Denmark", "Finland", "Turkey", "Morocco", "Egypt", "South Africa", "Kenya", "Tanzania", "Namibia", "United Arab Emirates", "Jordan", "Israel", "Saudi Arabia", "India", "Nepal", "Sri Lanka", "Maldives", "Thailand", "Vietnam", "Cambodia", "Laos", "Indonesia", "Singapore", "Malaysia", "Philippines", "Japan", "South Korea", "China", "Taiwan", "Australia", "New Zealand", "Fiji"]
def call_serpapi(client, top_country, top_average, input_dict, q):
"""
Query SerpApi, add the result values to the dict, calculate new top avg threshhold
Args:
client (serpapi.Client): Initialized SerpApi client used to execute API requests.
top_country (str): Current country with the highest avg from previous results
top_average (int): Current highest average from previous results
dict (dictionary): Dictionary for country, avg pairs
q (str): 5 countries we are comparing (top_average + next 4 from COUNTRIES)
Returns:
tuple [int, str]: new top average and associated top country
"""
# Query SerpApi including associated parameters
results = client.search({
"engine": "google_trends",
"q": q,
"tz": "420",
"cat": "67",
"date": "2026-05-01 2026-05-31"
})
new_top_avg = top_average
new_top_country = top_country
# Iterate through each the result in the averages array, 1 for each country
for result in results["interest_over_time"]["averages"]:
# Set the country (query), avg value in the dictionary
avg_value = result["value"]
avg_query = result["query"]
input_dict[avg_query] = avg_value
# Set the new highest average and country
if avg_value > new_top_avg:
new_top_avg = avg_value
new_top_country = avg_query
# Return new top average and country values for next search
return new_top_avg, new_top_country
def get_top_ten(client, sorted_results):
"""
Collect the top 10 values from the sorted list.
For tied avg values, compare with countries of the avg and sort accordingly
Args:
client (serpapi.Client): Initialized SerpApi client used to execute API requests.
sorted_results (dict): Sorted dictionary of country, avg pairs
Returns:
list: Top 10 countries
"""
top_ten = []
prev_value = next(iter(sorted_results.values()))
# Store countries with the same average
groups = []
# Iterate through each country in the sorted list
for country, value in sorted_results.items():
# If avg matches the previous avg, add to groups for future comparison
if prev_value == value:
groups.append(country)
# Else if the groups list is longer than 1, compare the countries using Google Trends to further sort the list
elif len(groups) > 1:
top_country = groups[0]
top_avg = 0
groups_avg = {}
i = 1
while(i<len(groups)):
top_avg, top_country = call_serpapi(client, top_country, top_avg, groups_avg, f"{top_country}, " + ", ".join(groups[i:i+4]))
# Increment i for the next countries
i += 4
sorted_groups = dict(sorted(groups_avg.items(), key=lambda item: item[1], reverse=True))
length = 10 - len(top_ten)
# If the length of the groups dictionary is more than the remaining we need, trim the list
if len(sorted_groups) < length:
length = len(sorted_groups)
top_ten.extend(list(sorted_groups.keys())[:length])
groups.clear()
groups.append(country)
# Otherwise add the 1 country to the top_ten then clear groups and append current country
else:
top_ten.append(groups[0])
groups.clear()
groups.append(country)
# Break once we have 10 results
if len(top_ten) >= 10:
break
prev_value = value
return top_ten
def main():
country_results = {}
i = 1
top_country = COUNTRIES[0]
top_avg = 0
client = serpapi.Client(api_key="239a6986a3f9b2c24395c10c2a9b39e76cd808b11a0cf5793f6350f86a6a9174")
# Iterate through the destination countries list and query method call_serpapi for each
while(i<len(COUNTRIES)):
top_avg, top_country = call_serpapi(client, top_country, top_avg, country_results, f"{top_country}, " + ", ".join(COUNTRIES[i:i+4]))
# Increment i for the next countries
i += 4
# Sort the avgs dictionary by avg
sorted_results = dict(sorted(country_results.items(), key=lambda item: item[1], reverse=True))
# Print the top 10 results from the get_top_ten def
print(get_top_ten(client, sorted_results))
if __name__ == "__main__":
main()For this example we're selecting the top 10 most popular destination spots in May 2025 and printing the list in order:
['Canada', 'Japan', 'Italy', 'India', 'Mexico', 'Singapore', 'France', 'Australia', 'China', 'Maldives']If you prefer the least popular destination spots, you can easily reverse the sort and the comparison logic.
You can also rank the full destination list if you require additional results / recommendations. As well as compare results across timezones and different dates.
In this blog we focused on the Google Trends API, however we offer many other travel APIs and more!
Some helpful travel APIs and blogs to get started:
How to Scrape Google Flights
There are many flights and many services that allow you to search for flights. Google offers a free flight booking search service as part of the Google Travel platform. It allows users to search for flights from various airlines, compare prices, and book tickets. You can search for flights by
SerpApiAndy L

Making a Flight Price Tracker with Google Flights and Make.com
Searching for a decent flight can be a time-consuming process. The good news is you can make your own, and you don’t even have to know how to code to do it. In this tutorial, I’ll walk you through how to use Make.com (a.k.a. Make) and SerpApi’s Google Flights API to track flight prices for you.
SerpApiAlex Barron
How to scrape Google Hotels Data (Tutorial 2026)
Learn how to scrape Google Hotels information to get property listing, property details, prices, and more using a simple API
SerpApiTerry Tan
Introducing SerpApi Google Travel Explore API
Google Travel Explore is Google’s premier search tool for destination discovery. It helps travelers decide where to go and when to plan their next trip, based on real-time flight deals and hotel pricing. Often found via the homepage of Google Flights, it allows user to browse destinations from
SerpApiMatteo Vedovati
Full list of APIs: https://serpapi.com/search-engine-apis
The Google Trends API is available for all users, sign up for a free account including 250 successful searches now!
You can use this for a travel app, coordinating travel for your company, targeting seasonal promotions, or other travel or trends use cases. SerpApi makes finding customized trending travel destinations easy.
If you need any help on your journey, send us a chat or an email to contact@serpapi.com, we are happy to help ❤️
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。