惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
G
Google Developers Blog
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
小众软件
小众软件
月光博客
月光博客
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
P
Proofpoint News Feed
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
The Cloudflare Blog
博客园_首页
美团技术团队
大猫的无限游戏
大猫的无限游戏
B
Blog
IT之家
IT之家
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

SerpApi

Scrape YouTube Channel Data with SerpApi How to scrape movie and TV results from the Google Play Store SerpApi Weekly Changelog: Sep 07 - 13, 2026 Introducing MCP Bundle Support for SerpApi SerpApi Weekly Changelog: Aug 31 - Sep 06, 2026 We Have Resolved the Google /goto URL Redirect Rollout How to scrape Zillow Reddit promised its users an open internet. Then it closed the door. SerpApi Weekly Changelog: August 24 - 30, 2026 Best web scraping tools in 2026 Google’s New /goto Redirect URLs: Resolution in Progress How to Scrape Walmart Reviews Results Understanding HTTP 429: Too Many Requests Google tried again. We’re moving to dismiss a second time. SerpApi Weekly Changelog: August 17 - 23, 2026 Introducing SerpApi's New Markdown Output SerpApi Surpasses 1.5 Million Activated User Accounts How a Lead Generation Company Scaled Outreach with SerpApi's Google Maps API SerpApi Weekly Changelog: August 10 - 16, 2026 How to scrape book results from the Google Play Store What is an API? Part 3: Dynamic Data Displays with D&D! We Filed an Amicus Brief in U.S. v. Google How to scrape Google Play Store game information SerpApi Weekly Changelog: August 03 - 09, 2026 Introducing SerpApi Search Tools: Real-Time Web Search for Python AI Agents Measuring World Cup Attention: What the data says about Vozinha SerpApi Weekly Changelog: July 27 - August 02, 2026 How to Scrape Google Maps Autocomplete Build an AI Event Discovery Agent That Adds Events to Your Calendar in One Click How to Aggregate Local Business Ratings-Without Averaging
Trending Travel Destinations using Python & SerpApi
Autumrose Stubbs · 2026-06-27 · via SerpApi

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.

Getting Started with SerpApi

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.

Libraries

In this example we will be using SerpApi's Python library.

To install the serpapi package, simply run the following command:

$ pip install serpapi

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

Relevant Parameters

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 here
  • tz: We'll be setting the timezone offset. This will be the UTC offset * 60 * -1
    • I am in MST which is UTC-7 (-7 * 60 * -1)
      • "tz": "420"
  • date: You can set this to past hrs, days, years
    • In this example, I want to travel May 2027. There are no future predictions so we will use May 2026 to predict May 2027.
      • "date": "2026-05-01 2026-05-31"
      • You can also collect these values for multiple years of May and average
  • 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"

Program Flow

  1. Assign the countries you want to compare to the COUNTRIES list
  2. main()
    1. Iterate through each country from COUNTRIES
    2. Combine every 4 countries + high threshold, separated by commas, into q
      1. call_serpapi()
        1. Query SerpApi using parameters discussed above.
        2. Add country, average pairs from results to country_results dict
        3. Find top country + average (threshold) for next search
    3. Sort country_results by average, descending, into sorted_results
    4. Print top 10 results
      1. get_top_ten()
        1. Extract results in order into a top 10 list
        2. If multiple countries' averages are tied, repeat call_serpapi with tied countries

Full Code

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()

Results

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.

Additional Travel Resources

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:

Google Flights API

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

Google Hotels API

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

Google Travel Explore API

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

Conclusion

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 ❤️

References