Oxylabs Documentation
English
Search
K

Trends: Explore

The google_trends_explore source is designed to retrieve Google Trends results.
NOTE: This service always delivers structured data - so there is no need to utilize the parse parameter with this source.

Query parameters

Parameter
Description
Default Value
source
Data source. More info.
google_trends_explore
query
UTF-encoded keyword
-
geo_location
The geographical location that the result should be adapted for. With Google Trends: Explore, we accept 2-letter ISO country codes as geo_location parameter values. We also allow using worldwide as a geo_location parameter value.
-
context:search_type
Lets you set the search type (one of the options on Google Trends GUI). Possible values: web_search, image_search, google_shopping, youtube_search.
web_search
context:date_from
The lower date bracket. Format: YYYY-MM-DD. Oldest possible date: 2004-01-01.
context:date_to
The upper date bracket. Format: YYYY-MM-DD. Oldest possible date: 2004-01-01.
context:category_id
Category ID. Please refer to this file in story for a list of valid values.
user_agent_type
Device type and browser. You can find the full list here.
desktop
callback_url
URL to your callback endpoint. More information here.
-
- required parameter

Code examples

In this example, we make a request to get trends results for a search term adidas between the 1st of January, 2021 and the 2nd of February, 2022, and set the category to "Arts & Entertainment" (category id: 3).
JSON
cURL
Python
PHP
HTTP
{
"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}
]
}
curl --user "user:pass1" 'https://realtime.oxylabs.io/v1/queries' \
-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}]}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_trends_explore',
'query': 'adidas',
'callback_url': 'https://your.callback.url',
'context': [
{'key': 'date_from', 'value': '2021-01-01'},
{'key': 'date_to', 'value': '2022-02-02'},
{'key': 'category_id', 'value': 3},
],
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Print prettified response to stdout.
pprint(response.json())
<?php
$params = [
'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
],
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://realtime.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "user" . ":" . "pass1");
$headers = [];
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result;
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
https://realtime.oxylabs.io/v1/queries?source=google_trends_explore&query=adidas&context[0][key]=date_from&context[0][value]=2021-01-01&&context[1][key]=date_to&context[1][value]=2022-02-02&context[2][key]=category_id&context[0][value]=3&access_token=12345abcde
The example above uses the Realtime integration method. If you would like to use some other integration method in your query (e.g. Push-Pull or Proxy Endpoint), refer to the integration methods section.
Last modified 5mo ago