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

推荐订阅源

S
Secure Thoughts
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Heimdal Security Blog
SecWiki News
SecWiki News
H
Hacker News: Front Page
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
AI
AI
C
Cybersecurity and Infrastructure Security Agency CISA
Scott Helme
Scott Helme
PCI Perspectives
PCI Perspectives
S
Securelist
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Cyberwarzone
Cyberwarzone
A
Arctic Wolf
Forbes - Security
Forbes - Security
T
Tor Project blog
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
I
Intezer
Martin Fowler
Martin Fowler
Help Net Security
Help Net Security
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cisco Talos Blog
Cisco Talos Blog
Latest news
Latest news
博客园 - 司徒正美
W
WeLiveSecurity
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
P
Palo Alto Networks Blog
Google DeepMind News
Google DeepMind News
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
V
Vulnerabilities – Threatpost
Jina AI
Jina AI
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
Simon Willison's Weblog
Simon Willison's Weblog
Project Zero
Project Zero
T
Threatpost
P
Privacy International News Feed
人人都是产品经理
人人都是产品经理
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research

SerpApi

The State of the SERP in the Age of AI How to find the Google Knowledge Graph ID (kgmid) for anything What is an API? Part 2: Feeding the Machine (JSON) Building an Accessibility Search Experience with Google Flights, Hotels, and Maps APIs SerpApi Weekly Changelog: July 06-12, 2026 How to Scrape Google Flights Deals with a simple API Monitoring FIFA World Cup scores with a simple API How to scrape Google sports results Build Smarter Pydantic AI Agents with Real-Time Search A complete guide to web scraping with Ruby (2026) SerpApi Weekly Changelog: June 29- July 05, 2026 Make no mistakes: agent usability testing Semantic Image Search with Elasticsearch What is an API? Part 1: The Secret Life of a Web Browser MCP Apps with FastMCP: Turning Tool Output Into Interactive UI How to Scrape Naver AI Briefings with SerpApi Connect Sakana AI (Fugu) with Web Search API SerpApi Weekly Changelog: June 22-28, 2026 How to scrape Bing reverse image search results Measuring Brand Presence Across AI Answer Engines SerpApi Weekly Changelog: June 15-21, 2026 How I Built a Star Wars Grogu Product Research Agent with Codex, Lark, and SerpApi How to scrape Bing web search results Categorizing hotels using Google Hotels images How to scrape Bing Images search results How to scrape Bing Copilot answers Build A No Code AI-Powered Local Lead Outreach System SerpApi Weekly Changelog: June 08-14, 2026 How to Do SEO Research with Claude Desktop and SerpApi MCP Track and Compare Product Prices Across Stores and Locations (SerpApi & Python) How to Extract Full Opinion Text from Google Scholar Case Law with SerpApi How to scrape Bing Maps search results SerpApi Weekly Changelog: June 01-07, 2026 Amazon ASIN Lookup API: Find and Fetch Product Details The State of MCP: Everything That Changed in H1 2026 How to scrape Bing News search results How to Connect Your Local LLM with Web Search Data SerpApi on Postman: One Unified Collection for Faster API Exploration SerpApi Weekly Changelog: May 25-31, 2026 Building an AI Agent in Python How to scrape Google Case Law API for Legal Research, Analytics, AI, and more SerpApi Achieves SOC 2 Type 2 and ISO 27001 Certification How to find your next product idea with Google Trends and SerpApi Scrape Competitors' Google Ads Data (Tutorial 2026) Using SerpApi and DeepSeek to Break Down Dan Koe’s Content Strategy SerpApi Weekly Changelog: May 18-24, 2026 How to scrape Bing Videos search results How to Scrape Instagram Profile Data with SerpApi How to scrape Bing Shopping search results How to Scrape Google Hotels Reviews SerpApi Weekly Changelog: May 11-17, 2026 5 Things You Can Build with Claude Code and Live Search Data Real Estate Data API for PropTech Developers How to Scrape Apple Maps with SerpApi How to scrape Google Trends
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