如何使用 TalorData 抓取 Google Trends 搜尋結果
了解如何使用 TalorData SERP API 抓取 Google Trends 搜尋結果。本技術指南涵蓋了查詢參數、Python requests 請求、時間趨勢、地區資料、相關查詢、相關主題、CSV 匯出以及常見錯誤。
Google Trends 很適合用來觀察搜尋需求的變化。它能幫你在排名、流量、銷售或客服問題出現之前,先看到使用者注意力正在往哪裡移動。
對 SEO 和內容團隊來說,它可以回答這些問題:
|
問題 |
為什麼重要 |
|
這個主題是在成長還是衰退? |
內容規劃 |
|
哪個地區的興趣更強? |
Local SEO 和市場研究 |
|
哪些相關查詢正在上升? |
關鍵字發現 |
|
哪些 topics 和這個查詢有關? |
Topic clustering |
|
需求是否有季節性? |
Campaign planning |
|
哪個產品或品牌正在獲得關注? |
Competitive monitoring |
問題是,Google Trends 更像是一個互動介面,不是乾淨的資料管線。如果你要做重複採集、dashboard、alerts 或 AI workflows,手動查看 Trends 網站不夠。
這時就需要 Google Trends SERP API workflow。
透過 TalorData,你可以在 SERP API layer 中請求 Google Trends data,設定 query、category、date range、location、search type 和 output options,並將結果解析成結構化資料。TalorData 的 Google Trends 參數指南列出 q 為必填搜尋查詢,並包含 category、date 等 Google Trends request 設定。
可以從 Google Trends 收集什麼?
Google Trends data 和一般 Google Search ranking data 不一樣。你不是在收集 title、URL、snippet、position 這類 organic results。
你收集的是趨勢訊號。
常見資料類型包括:
|
Data type |
說明 |
|
Interest over time |
搜尋興趣如何隨時間變化 |
|
Interest by region |
哪些地區更熱門 |
|
Related queries |
和關鍵字相關的搜尋詞 |
|
Related topics |
和關鍵字相關的 topics |
|
Rising queries |
快速成長的查詢 |
|
Top queries |
最相關的熱門查詢 |
Google Trends 網站本身也將 Trends 定位為按時間、地點和熱度探索搜尋興趣的工具。
常見技術場景包括:
|
使用場景 |
範例 |
|
SEO topic research |
追蹤 “AI agent workflow” 是否成長 |
|
Content planning |
找 “Google Trends API” 的 rising questions |
|
Market research |
比較不同國家的需求 |
|
Product research |
觀察品牌或品類熱度 |
|
Local strategy |
看哪些地區更常搜尋某主題 |
|
AI agents |
讓 agent 在寫報告前先檢測趨勢 |
基本請求結構
實際 endpoint 和 authentication 格式,請以你的 TalorData dashboard 或 API docs 為準。
一個典型請求長這樣:
POST TALORDATA_SERP_ENDPOINT
Authorization: Bearer TALORDATA_API_KEY
Content-Type: application/json
{
"engine": "google_trends",
"q": "coffee",
"date": "today 12-m",
"geo": "US",
"cat": "0",
"data_type": "TIMESERIES"
}
核心參數:
|
Parameter |
Purpose |
|
|
選擇 Google Trends |
|
|
搜尋查詢 |
|
|
時間範圍 |
|
|
地理位置 |
|
|
類別 |
|
|
返回哪一類 Trends data |
|
|
Timezone offset |
|
|
搜尋屬性,例如 web、news、images、shopping、YouTube |
Google Trends 工具通常使用 TIMESERIES、GEO_MAP、RELATED_QUERIES 和 RELATED_TOPICS 來表示 interest over time、region interest、related queries 和 related topics。
Step 1:準備 API key
將 TalorData API key 和 endpoint 存成環境變數。
export TALORDATA_API_KEY="your_api_key_here"
export TALORDATA_SERP_ENDPOINT="your_talordata_serp_endpoint_here"
Windows PowerShell:
setx TALORDATA_API_KEY "your_api_key_here"
setx TALORDATA_SERP_ENDPOINT "your_talordata_serp_endpoint_here"
安裝 Python dependencies:
pip install requests pandas
Step 2:建立可重用 Python client
下面這個 function 會發送 Google Trends request 並返回 JSON。
import os
import requests
from typing import Any, Dict, Optional
TALORDATA_API_KEY = os.getenv("TALORDATA_API_KEY")
TALORDATA_SERP_ENDPOINT = os.getenv("TALORDATA_SERP_ENDPOINT")
def fetch_google_trends(
query: str,
data_type: str = "TIMESERIES",
geo: str = "US",
date: str = "today 12-m",
cat: str = "0",
tz: str = "420",
gprop: Optional[str] = None
) -> Dict[str, Any]:
"""
Fetch Google Trends data with TalorData SERP API.
Replace the request body or headers if your TalorData dashboard
shows a different authentication format.
"""
if not TALORDATA_API_KEY:
raise RuntimeError("Missing TALORDATA_API_KEY environment variable.")
if not TALORDATA_SERP_ENDPOINT:
raise RuntimeError("Missing TALORDATA_SERP_ENDPOINT environment variable.")
payload = {
"engine": "google_trends",
"q": query,
"data_type": data_type,
"geo": geo,
"date": date,
"cat": cat,
"tz": tz
}
if gprop:
payload["gprop"] = gprop
headers = {
"Authorization": f"Bearer {TALORDATA_API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
TALORDATA_SERP_ENDPOINT,
json=payload,
headers=headers,
timeout=30
)
response.raise_for_status()
return response.json()
使用方式:
if __name__ == "__main__":
data = fetch_google_trends(
query="AI agents",
data_type="TIMESERIES",
geo="US",
date="today 12-m"
)
print(data)
Step 3:取得 interest over time
Interest over time 通常是最常用的 Google Trends chart。
它可以回答:
|
問題 |
範例 |
|
需求是否成長? |
“AI agents” 過去 12 個月是否上升 |
|
是否有季節性? |
“Halloween costume” 每年 10 月是否上升 |
|
活動是否帶來熱度? |
品牌詞在發布後是否上升 |
|
熱度是否衰退? |
新聞週期後主題是否冷卻 |
請求:
data = fetch_google_trends(
query="AI agents",
data_type="TIMESERIES",
geo="US",
date="today 12-m"
)
常見 response 會包含 timeline array,例如 date、timestamp 和 values。
{
"interest_over_time": {
"timeline_data": [
{
"date": "Jan 1–7, 2026",
"timestamp": "1767225600",
"values": [
{
"value": "72",
"extracted_value": 72
}
]
}
]
}
}
Parser:
from typing import Any, Dict, List
def parse_interest_over_time(data: Dict[str, Any]) -> List[Dict[str, Any]]:
timeline = (
data.get("interest_over_time", {})
.get("timeline_data", [])
)
rows = []
for item in timeline:
values = item.get("values", [])
if not values:
continue
first_value = values[0]
rows.append({
"date": item.get("date"),
"timestamp": item.get("timestamp"),
"value": first_value.get("value"),
"extracted_value": first_value.get("extracted_value")
})
return rows
保存成 CSV:
import pandas as pd
data = fetch_google_trends(
query="AI agents",
data_type="TIMESERIES",
geo="US",
date="today 12-m"
)
rows = parse_interest_over_time(data)
df = pd.DataFrame(rows)
df.to_csv("google_trends_interest_over_time.csv", index=False)
print(df.head())
Step 4:比較多個 keywords
Google Trends 常常在比較關鍵字時更有價值。
data = fetch_google_trends(
query="AI agents,RAG,LLM apps",
data_type="TIMESERIES",
geo="US",
date="today 12-m"
)
適合比較:
|
Comparison |
用途 |
|
Brand vs competitor |
市場需求 |
|
Topic A vs topic B |
內容優先級 |
|
Old term vs new term |
語言變化 |
|
Product category vs feature |
使用者意圖 |
|
Keyword variants |
SEO targeting |
注意:Trends values 通常是 indexed values,不是絕對搜尋量。Google Search Central blog 說明,Trends data 反映的是 search interest,不是絕對數字。
所以 100 不等於 100 次搜尋,而是所選範圍內的最高相對熱度。
Step 5:取得 interest by region
Regional data 可以告訴你某個 topic 在哪些地區更強。
data = fetch_google_trends(
query="electric bike",
data_type="GEO_MAP",
geo="US",
date="today 12-m"
)
適合:
|
使用場景 |
範例 |
|
Local SEO |
哪些州更常搜尋 “emergency plumber”? |
|
Market expansion |
哪裡的 “EV charger installation” 正在成長? |
|
Ad planning |
哪些地區值得投放? |
|
Content localization |
不同國家用什麼詞? |
|
Product demand |
哪些地區品類需求更高? |
Parser:
def parse_geo_map(data: Dict[str, Any]) -> List[Dict[str, Any]]:
geo_data = data.get("interest_by_region", [])
rows = []
for item in geo_data:
rows.append({
"location": item.get("location"),
"geo_code": item.get("geo_code"),
"value": item.get("value"),
"extracted_value": item.get("extracted_value")
})
return rows
因為不同 response structure 可能不同,建議先檢查 raw response:
import json
print(json.dumps(data, indent=2, ensure_ascii=False)[:3000])
先用小手電筒照一下洞口,後面就不容易在資料洞穴裡撞牆。
Step 6:取得 related queries
Related queries 很適合做 keyword discovery。
data = fetch_google_trends(
query="google trends api",
data_type="RELATED_QUERIES",
geo="US",
date="today 12-m"
)
常見分組:
|
Group |
Meaning |
|
Top |
與查詢最相關的搜尋詞 |
|
Rising |
快速成長的搜尋詞 |
用途:
|
Workflow |
用法 |
|
SEO keyword research |
找 long-tail terms |
|
Content planning |
找文章主題 |
|
Product marketing |
發現使用者語言 |
|
Competitive research |
觀察相鄰需求 |
|
AI agents |
生成新的研究方向 |
Parser:
def parse_related_queries(data: Dict[str, Any]) -> List[Dict[str, Any]]:
related = data.get("related_queries", {})
rows = []
for group_name in ["top", "rising"]:
for item in related.get(group_name, []):
rows.append({
"group": group_name,
"query": item.get("query"),
"value": item.get("value"),
"extracted_value": item.get("extracted_value"),
"link": item.get("link")
})
return rows
保存 CSV:
data = fetch_google_trends(
query="google trends api",
data_type="RELATED_QUERIES",
geo="US",
date="today 12-m"
)
rows = parse_related_queries(data)
pd.DataFrame(rows).to_csv("related_queries.csv", index=False)
Step 7:取得 related topics
Related topics 適合處理語義模糊的詞。
例如 “python” 可能是 programming language,也可能是 snake。Topic data 可以幫你理解查詢周圍的語義環境。
data = fetch_google_trends(
query="python",
data_type="RELATED_TOPICS",
geo="US",
date="today 12-m"
)
Parser:
def parse_related_topics(data: Dict[str, Any]) -> List[Dict[str, Any]]:
related = data.get("related_topics", {})
rows = []
for group_name in ["top", "rising"]:
for item in related.get(group_name, []):
topic = item.get("topic", {})
rows.append({
"group": group_name,
"topic_title": topic.get("title"),
"topic_type": topic.get("type"),
"topic_id": topic.get("value") or item.get("id"),
"value": item.get("value"),
"extracted_value": item.get("extracted_value"),
"link": item.get("link")
})
return rows
適合:
|
使用場景 |
範例 |
|
Entity SEO |
理解 related entities |
|
Topic clustering |
建 content hubs |
|
AI search |
把 related topics 餵給 agent |
|
Market research |
發現相鄰品類 |
|
Brand research |
看品牌周圍的 topics |
Step 8:使用 categories
cat 參數可以按 category 限定查詢。TalorData Google Trends 參數指南將 cat 列為 optional category parameter,預設值為 0,表示 all categories。
data = fetch_google_trends(
query="apple",
data_type="TIMESERIES",
geo="US",
date="today 12-m",
cat="5"
)
對語義模糊詞很有用:
|
Query |
可能含義 |
|
apple |
水果、公司、音樂、設備 |
|
jaguar |
動物、汽車品牌、球隊 |
|
python |
蛇、程式語言 |
|
java |
咖啡、島嶼、程式語言 |
Category 可以降低雜訊。
Step 9:使用 search properties
gprop 常用於指定 Google property:
|
|
Meaning |
|
empty |
Web Search |
|
|
Image Search |
|
|
News Search |
|
|
Google Shopping |
|
|
YouTube Search |
範例:
# News interest
data = fetch_google_trends(
query="AI regulation",
data_type="TIMESERIES",
geo="US",
date="today 3-m",
gprop="news"
)
# YouTube interest
data = fetch_google_trends(
query="python tutorial",
data_type="TIMESERIES",
geo="US",
date="today 12-m",
gprop="youtube"
)
對 SEO 來說,這很重要。某個 topic 在 web search 上可能平穩,但在 YouTube 或 News 裡正在上升。
Step 10:完整 script
下面是一個完整範例,會收集 interest over time 和 related queries。
import os
import json
import requests
import pandas as pd
from typing import Any, Dict, List, Optional
TALORDATA_API_KEY = os.getenv("TALORDATA_API_KEY")
TALORDATA_SERP_ENDPOINT = os.getenv("TALORDATA_SERP_ENDPOINT")
def fetch_google_trends(
query: str,
data_type: str = "TIMESERIES",
geo: str = "US",
date: str = "today 12-m",
cat: str = "0",
tz: str = "420",
gprop: Optional[str] = None
) -> Dict[str, Any]:
if not TALORDATA_API_KEY:
raise RuntimeError("Missing TALORDATA_API_KEY environment variable.")
if not TALORDATA_SERP_ENDPOINT:
raise RuntimeError("Missing TALORDATA_SERP_ENDPOINT environment variable.")
payload = {
"engine": "google_trends",
"q": query,
"data_type": data_type,
"geo": geo,
"date": date,
"cat": cat,
"tz": tz
}
if gprop:
payload["gprop"] = gprop
response = requests.post(
TALORDATA_SERP_ENDPOINT,
json=payload,
headers={
"Authorization": f"Bearer {TALORDATA_API_KEY}",
"Content-Type": "application/json"
},
timeout=30
)
response.raise_for_status()
return response.json()
def parse_interest_over_time(data: Dict[str, Any]) -> List[Dict[str, Any]]:
timeline = data.get("interest_over_time", {}).get("timeline_data", [])
rows = []
for item in timeline:
values = item.get("values", [])
if not values:
continue
first_value = values[0]
rows.append({
"date": item.get("date"),
"timestamp": item.get("timestamp"),
"value": first_value.get("value"),
"extracted_value": first_value.get("extracted_value")
})
return rows
def parse_related_queries(data: Dict[str, Any]) -> List[Dict[str, Any]]:
related = data.get("related_queries", {})
rows = []
for group_name in ["top", "rising"]:
for item in related.get(group_name, []):
rows.append({
"group": group_name,
"query": item.get("query"),
"value": item.get("value"),
"extracted_value": item.get("extracted_value"),
"link": item.get("link")
})
return rows
def main() -> None:
query = "google trends api"
trend_data = fetch_google_trends(
query=query,
data_type="TIMESERIES",
geo="US",
date="today 12-m"
)
trend_rows = parse_interest_over_time(trend_data)
pd.DataFrame(trend_rows).to_csv("interest_over_time.csv", index=False)
related_data = fetch_google_trends(
query=query,
data_type="RELATED_QUERIES",
geo="US",
date="today 12-m"
)
related_rows = parse_related_queries(related_data)
pd.DataFrame(related_rows).to_csv("related_queries.csv", index=False)
with open("raw_google_trends_response.json", "w", encoding="utf-8") as file:
json.dump({
"timeseries": trend_data,
"related_queries": related_data
}, file, ensure_ascii=False, indent=2)
print("Saved interest_over_time.csv")
print("Saved related_queries.csv")
print("Saved raw_google_trends_response.json")
if __name__ == "__main__":
main()
如何使用這些資料?
當 Google Trends data 變成 CSV 或 JSON 之後,可以放進很多流程:
|
Workflow |
Trends data 如何幫助 |
|
SEO planning |
優先做成長中的 topics |
|
Content calendar |
按季節需求安排文章 |
|
Competitor monitoring |
比較品牌興趣 |
|
Product research |
發現品類成長 |
|
Local marketing |
選擇目標地區 |
|
AI agents |
把 trend signals 餵給 planning tasks |
|
RAG pipelines |
把 trend snapshots 存成 structured context |
範例內容流程:
Google Trends API
↓
Collect related rising queries
↓
Cluster queries by topic
↓
Check SERP competition
↓
Generate content brief
↓
Track performance over time
Trends data 不應該取代 keyword volume、ranking data 或 conversion data。它是一層訊號。用得好,它能在流量報表敲門前,提前告訴你注意力正在往哪裡跑。
常見錯誤
把 Trends values 當成 search volume
Google Trends values 是 indexed interest scores,不是實際搜尋次數。100 表示所選範圍內的最高相對熱度。
比較不同 requests 時不保存 context
一定要保存:
|
Context |
|
Query |
|
Geo |
|
Date range |
|
Category |
|
Search property |
|
Data type |
|
Timezone |
|
Collection timestamp |
沒有 context,數字就會變成裝飾用紙屑。
忽略 categories
語義模糊的詞需要 category,否則可能混入無關 intent。
只看 interest over time
Related queries 和 related topics 往往對 SEO 和 content planning 更可執行。
不保存 raw responses
建立 parser 時,請保存 raw JSON。欄位變化或 debug 時會很有用。
結語
使用 TalorData 抓取 Google Trends search results,本質上是把互動式 Trends 操作變成可重複的資料管線。
先從核心參數開始:
|
Parameter |
Start with |
|
|
Topic 或 keyword |
|
|
|
|
|
國家或地區 |
|
|
時間範圍 |
|
|
類別 |
|
|
Web、news、images、shopping、YouTube |
|
|
Timezone offset |
接著把 response 解析成乾淨表格:interest over time、regional interest、related queries 和 related topics。
資料一旦結構化,就可以支撐 SEO planning、market research、dashboards、alerts 和 AI agents。
Google Trends 是搜尋需求變成浪潮前的低語。好的 API workflow,能讓你提早聽見。立即免費測試Google Trends API