Documentation has been updated: see help center and changelog in one place.

趋势:探索

按关键词、日期范围和类别提取 Google Trends 数据。API 支持多种搜索类型和过滤。

google_trends_explore 源用于检索 Google 趋势结果。

请求示例

在此示例中,我们发出请求以获取搜索词的趋势结果 adidas 在 2021 年 1 月 1 日至 2022 年 2 月 2 日之间,并将类别设置为“艺术与娱乐”(类别 id: 3).

curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "google_trends_explore",
        "query": "adidas",
        "context": [
            {"key": "date_from", "value": "2021-01-01"},
            {"key": "date_to", "value": "2022-02-02"},
            {"key": "category_id", "value": 3}
        ]
    }'

在我们的示例中,我们使用同步的 Realtime 集成方法。如果您想使用 Proxy Endpoint 或异步的 Push-Pull 集成,请参阅 集成方法 部分。

请求参数值

通用

用于抓取 Google 趋势结果的基本设置和自定义选项。

参数
说明
默认值

source

设置抓取器。

google_trends_explore

query

要搜索的关键字或短语。

-

callback_url

回调端点的 URL。 更多信息.

-

user_agent_type

设备类型和浏览器。完整列表可在 此处.

desktop

geo_location

结果应适配的地理位置。对于 Google Trends: Explore,我们接受作为参数值的 2 位字母 ISO 国家代码。 geo_location 参数值。

-

- 必填参数

过滤

用于定制和精细化搜索上下文的高级选项。

参数
说明
默认值

context:

search_type

允许您设置搜索类型(Google Trends GUI 上的选项之一)。可能的值: web_search, image_search, google_shopping, youtube_search.

web_search

context:

date_from

较低的日期界限。格式: YYYY-MM-DD。 最早可用日期: 2004-01-01.

-

context:

date_to

较高的日期界限。格式: YYYY-MM-DD。 最早可用日期: 2004-01-01.

-

context:

category_id

类别 ID。请参阅 此文件 以获取有效值列表。

-

上下文参数

所有上下文参数应作为对象添加到 context 数组中,包含 keyvalue 键值对,例如:

...
"context": [
    {
        "key": "filter",
        "value": "0"
    }
]
...

注意: 本服务始终提供结构化数据 - 因此无需对该源使用 parse 参数。

输出示例

{
    "results": [
        {
            "content":"{\"interest_over_time\": [{\"keyword\": \"adidas\", \"items\": [{\"time\": \"Jan 3\ \–\ 9, 2021\", \"value\": 75}, {\"time\": \"Jan 10\ \–\ 16, 2021\", \"value\": 79}...{\"query\": \"adidas zx\", \"value\": 10, \"formatted_value\": \"10\", \"link\": \"/trends/explore?q=adidas+zx&date=2021-01-01+2022-02-02\"}]}]}",
            "created_at": "2024-02-13 11:33:21",
            "updated_at": "2024-02-13 11:33:27",
            "page": 1,
            "url": "https://trends.google.com/trends/api/explore?hl=en-US&tz=0&req=%7B%22comparisonItem%22%3A+%5B%7B%22keyword%22%3A+%22adidas%22%2C+%22geo%22%3A+%22%22%2C+%22time%22%3A+%222021-01-01+2022-02-02%22%7D%5D%2C+%22category%22%3A+0%2C+%22property%22%3A+%22%22%7D",
            "job_id": "7163133042662350849",
            "status_code": 200
        }
    ]
}

最后更新于

这有帮助吗?