我们可以在 Google 上抓取和解析各种页面类型。您可以向我们提供一个完整的URL 或通过专门建立的页面类型提供一些输入参数(如搜索 ,广告 , 酒店, 和其他),所以我们可以在我们的终端形成 URL。
总览
以下概述我们通过 Google 支持的所有可用数据source值 。
google
提交您喜欢的任意 Google 网址。
取决于 URL。
google_search
SERP。
是。
google_ads
SERP,针对最大广告率进行优化。 仅 num=10。
是。
google_hotels
传奇酒店的服务。
是。
google_travel_hotels
旅行:酒店服务。
是。
google_images
反向图像搜索。
是。
google_suggest
自动完成的搜索词建议。
是。
google_msv_v2
每月搜寻流量。
是。
google_trends_explore
趋势。
是。
您可以通过选择菜单右侧的名称跳转至您喜欢的 Google 页面类型。每个页面都包含参数表以及代码示例,可帮助您开始查询。
URL
google 源设计用于检索各种 Google URL 中的内容。这意味着,您可以向我们提供一个转至所需 Google 页面的直接 URL,而不是发送多个参数。我们不会剥离任何参数或以任何其他方式更改您的 URL。
这个数据源也支持解析数据(JSON 格式的结构化数据),只要提交的 URL 用于 Google(SERP 页面)。如果我们不能确认这是一个 SERP 页面请求,我们将返回一个故障信息。
查询参数
- 必须提供的参数
代码示例
在以下示例中,API 将检索一个 Google Scholar 搜索页面。
{
"source": "google",
"url": "https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp="
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google", "url": "https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp="}{"source": "google", "url": "https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp="}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google',
'url': 'https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp='
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Instead of response with job status and results url, this will return the
# JSON response with results.
pprint(response.json())yhon<?php
$params = array(
'source' => 'google',
'url' => 'https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp='
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://data.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 = array();
$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);
?># URL has to be encoded to escape `&` and `=` characters:
# URL: https://scholar.google.com/scholar?hl=en&q=newton&btnG=&as_sdt=1%2C5&as_sdtp=
# Encoded URL: https%3A%2F%2Fscholar.google.com%2Fscholar%3Fhl%3Den%26q%3Dnewton%26btnG%3D%26as_sdt%3D1%252C5%26as_sdtp%3D
https://realtime.oxylabs.io/v1/queries?source=google&url=https%3A%2F%2Fscholar.google.com%2Fscholar%3Fhl%3Den%26q%3Dnewton%26btnG%3D%26as_sdt%3D1%252C5%26as_sdtp%3D&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
搜索
google_search 源设计用于检索 Google Search 结果(SERP)。
查询参数
domain
域本地化
com
query
UTF 编码的关键字
-
start_page
起始页数
1
pages
检索的页数
1
limit
每页中要检索的结果数
10
context:
fpstate
设置 fpstate 值为 aig 将使 Google 加载更多应用程序。这个参数只有在与渲染 参数一起使用时才有用。
-
context:
nfpr
true 将关闭拼写自动纠正功能。
false
context:limit_per_page
如果要使用相同的IP地址抓取多个页面,请包含一个JSON数组,并使用 page 键指定页面数量。还必须通过添加 limit 键来指示每个页面上的自动搜索结果数,例如:
"context": [{
"key": "limit_per_page",
"value": [
{"page": 1, "limit": 10},
{"page": 2, "limit": 90}
]
}]-
context:
tbm
待配或 tbm 参数。可接受的值是:app、blg、bks、dsc、isch、nws、pts、plcs、rcp、lcl。
-
context:
tbs
ttbs 参数这个参数就像一个容器,用于存放更多无名 Google 参数,比如按日期限制/排序结果,以及其他过滤器,其中一些取决于 tbm 参数(例如 tbs=app_os:1 只适用于 tbm 值 app).单击此处了解更多相关信息。
-
- 必须提供的参数
代码示例
在以下示例中,我们请求从 google.nl 域获得 2 个结果页面,从第 11 页到第 12 页,搜索词为 adidas。SERP 将被过滤,只包含法语的结果。
{
"source": "google_search",
"domain": "nl",
"query": "adidas",
"start_page": 11,
"pages": 2,
"parse": true,
"context": [
{
"key": "results_language",
"value": "fr"
}]
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_search", "domain": "nl", "query": "adidas", "start_page": 11, "pages": 2, "parse": true, "context": [{"key": "results_language", "value": "fr"}]}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_search',
'domain': 'nl',
'query': 'adidas',
'start_page': 11,
'pages': 2,
'context': [
{'key': 'results_language', 'value': 'fr'},
],
}
# 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 = array(
'source' => 'google_search',
'domain' => 'nl',
'query' => 'adidas',
'start_page' => 11,
'pages' => 2,
'context' => array(
'key' => 'results_language',
'value' => 'fr'
)
);
$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 = array();
$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);
?>hphttps://realtime.oxylabs.io/v1/queries?source=google_search&domain=nl&query=adidas&start_page=11&pages=2&context[0][key]=results_language&context[0][value]=fr&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
广告
google_ads 源被优化为检索带有付费广告的 Google Search 结果页(SERP)。这个来源每页只返回十个结果,确保显示付费结果的机会最高。除此以外,它支持与常规 搜索 相同的参数。
查询参数
domain
Google 的域名本地化。单击此处查看可用域名的完整列表。
com
query
UTF 编码的关键字
-
start_page
起始页数
1
pages
检索的页数
1
locale
Accept-Language 标头值,它可以更改您的 Google 搜索页面的网页界面语言。更多信息。
-
context:
nfpr
true 将关闭拼写自动纠正功能。
false
context:
tbm
待配或 tbm 参数。可接受的值是:app、blg、bks、dsc、isch、nws、pts、plcs、rcp、lcl。
-
context:
tbs
tbs 参数这个参数就像一个容器,用于存放更多无名 google 参数,比如按日期限制/排序结果以及其他过滤器,其中一些取决于tbm 参数(例如 tbs=app_os:1 只适用于 tbm 值 app).单击此处了解更多相关信息。
-
- 必须提供的参数
代码示例
在这个示例中,我们向 google.nl 发送请求检索关键字 adidas 的搜索结果。
{
"source": "google_ads",
"domain": "nl",
"query": "adidas",
"parse": true
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '/{
"source": "google_ads",
"domain": "nl",
"query": "adidas",
"parse": true
}'import requests
from pprint import pprinthp
# Structure payload.
payload = {
'source': 'google_ads',
'domain': 'nl',
'query': 'adidas'
}
# 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 = array(
'source' => 'google_ads',
'domain' => 'nl',
'query' => 'adidas'
);
$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 = array();
$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_ads&domain=nl&query=adidas以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
酒店
google_hotels 数据源设计用于检索 Google Hotel 搜索结果。
查询参数
domain
域本地化
com
query
UTF 编码的关键字
-
start_page
起始页数。
1
pages
检索的页数。
1
limit
每页中要检索的结果数。
10
context:
nfpr
true 将关闭拼写自动纠正功能。
false
context:
hotel_occupancy
宾客人数。
2
context:
hotel_dates
入住酒店时长,入住日期 - 离开日期。示例:2023-07-12,2023-07-13。
-
- 必须提供的参数
代码示例
在这个示例中,我们请求从 google.com.sons. 检索前 3 页页面,以查询2023-10-01 至 2023-10-10期间在巴黎是否有可容纳1名客人的酒店。
{
"source": "google_hotels",
"domain": "com",
"pages": 3,
"query": "hotels in Paris",
"context": [
{
"key": "hotel_occupancy",
"value": 1
},
{
"key": "hotel_dates",
"value": "2023-10-01,2023-10-10"
}]
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_hotels", "domain": "com", "pages": 3, "query": "hotels in Paris", "context": [{"key": "hotel_occupancy", "value": 1}, {"key": "hotel_dates", "value": "2023-10-01,2023-10-10"}]}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_hotels',
'domain': 'com',
'query': 'hotels in Paris',
'pages': 3,
'context': [
{'key': 'hotel_occupancy', 'value': 1},
{'key': 'hotel_dates', 'value': '2023-10-01,2023-10-10'},
],
}
# 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 = array(
'source' => 'google_hotels',
'domain' => 'com',
'query' => 'hotels in Paris',
'pages' => 3,
'context' => [
[
'key' => 'hotel_occupancy',
'value' => 1,
],
[
'key' => 'hotel_dates',
'value': '2023-10-01,2023-10-10',
]
]
);
$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 = array();
$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_hotels&domain=com&query=hotels+in+Paris&pages=3&context[0][key]=hotel_occupancy&context[0][value]=1&context[1][key]=hotel_dates&context[1][value]=2023-10-01,2023-10-10&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
旅行:酒店
Google_travel_hotels 数据源设计用于检索 Google Travel 服务的酒店搜索结果。
查询参数
domain
域本地化
com
query
UTF 编码的关键字
-
start_page
起始页数
1
locale
Accept-Language 标头值,它可以更改您的 Google 搜索页面的网页界面语言。更多信息。
-
geo_location
结果应适应的地理位置。正确使用这个参数对获得正确数据极为重要。请注意,这个来源可以接受数量有限的 geo_location 值 - 请检查 本节 来查看不 产生准确结果的geo_location 值。
-
context:
hotel_occupancy
宾客人数
2
context:
hotel_classes
按酒店星级过滤结果。您可以指定一个或多个介于2 和 5之间的值.例如:[3,4]
-
context:
hotel_dates
住在酒店的日期,入住日期 - 离开日期。示例:2023-07-12,2023-07-13
-
- 必须提供的参数
代码示例
在这个示例中,我们请求从 google.com 检索第 2 页结果页面,以查询 2023-10-01 至 2023-10-10期间在巴黎是否有可容纳2名客人的2 至 4-星级酒店。
{
"source": "google_travel_hotels",
"domain": "com",
"start_page": 2,
"query": "hotels in Paris",
"context": [
{
"key": "hotel_occupancy",
"value": 2
},
{
"key": "hotel_dates",
"value": "2023-10-01,2023-10-10"
},
{
"key": "hotel_classes",
"value": [2,4]
}]
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_travel_hotels", "domain": "com", "start_page": 2, "query": "hotels in Paris", "context": [{"key": "hotel_occupancy", "value": 2}, {"key": "hotel_dates", "value": "2023-10-01,2023-10-10"}, {"key": "hotel_classes", "value": [2,4]}]}'ythimport requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_travel_hotels',
'domain': 'com',
'query': 'hotels in Paris',
'start_page': 2,
'context': [
{'key': 'hotel_occupancy', 'value': 1},
{'key': 'hotel_dates', 'value': '2023-10-01,2023-10-10'},
{'key': 'hotel_classes', 'value': [2,4]},
],
}
# 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 = array(
'source' => 'google_travel_hotels',
'domain' => 'com',
'query' => 'hotels in Paris',
'start_page' => 2,
'context' => [
[
'key' => 'hotel_occupancy',
'value' => 1,
],
[
'key' => 'hotel_dates',
'value': '2023-10-01,2023-10-10',
],
[
'key' => 'hotel_classes',
'value' => [2,4],
]
]
);
$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 = array();
$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);
?>phphttps://realtime.oxylabs.io/v1/queries?source=google_travel_hotels&domain=com&query=hotels+in+Paris&start_page=3&context[0][key]=hotel_occupancy&context[0][value]=1&context[1][key]=hotel_dates&context[1][value]=2023-10-01,2023-10-10&context[2][key]=hotel_classes&context[2][value]=[2,4]&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
图片
google_images 源设计用于检索图像搜索页面以查找与提供query参数和包含这些图像的网站的图像相似的图像。
查询参数
domain
域本地化
com
query
图像 URL
-
start_page
起始页数
1
pages
检索的页数
1
context:
nfpr
true 将关闭拼写自动纠正功能。
false
- 必须提供的参数
代码示例
在这个示例中,我们请求获得这个图像的反向图像搜索结果: 来自 google.com 的https://newsneakernews-wpengine.netdna-ssl.com/wp-content/uploads/2017/03/adidas-boost-march-25-2017.jpg。
{
"source": "google_images",
"domain": "com",
"query": "https://newsneakernews-wpengine.netdna-ssl.com/wp-content/uploads/2017/03/adidas-boost-march-25-2017.jpg",
"context": [
{
"key": "search_operators",
"value": [
{"key": "site", "value": "example.com"},
{"key": "filetype", "value": "html"},
{"key": "inurl", "value": "image"}
}],
"callback_url": "https://your.callback.url"
}curl --user user:pass1 'https://data.oxylabs.io/v1/queries'\
-H "Content-Type: application/json" \
-d '{"source": "google_images", "domain": "com", "query": "https://newsneakernews-wpengine.netdna-ssl.com/wp-content/uploads/2017/03/adidas-boost-march-25-2017.jpg", "context": [{"key": "search_operators","value": [{"key": "site", "value": "example.com"}, {"key": "filetype", "value": "html"}, {"key": "inurl", "value": "image"}}], "callback_url": "https://your.callback.url"}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_images',
'domain': 'com',
'query': 'https://newsneakernews-wpengine.netdna-ssl.com/wp-content/uploads/2017/03/adidas-boost-march-25-2017.jpg',
'context': [
{
'key': 'search_operators',
'value': [
{'key': 'site', 'value': 'example.com'},
{'key': 'filetype', 'value': 'html'},
{'key': 'inurl', 'value': 'image'}
]
}
]
}
# 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 = array(
'source' => 'google_images',
'domain' => 'com',
'query' => 'https://newsneakernews-wpengine.netdna-ssl.com/wp-content/uploads/2017/03/adidas-boost-march-25-2017.jpg',
'context' => [
[
'key' => 'hotel_occupancy',
'value' => [
['key' => 'site', 'value' => 'example.com'],
['key' => 'filetype', 'value' => 'html'],
['key' => 'inurl', 'value' => 'image']
]
]
)
$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 = array();
$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_images&domain=com&query=https://www.example.com/img/image.jpg&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
建议
google_suggest 源设计用于检索 Google 的搜索术语建议。
查询参数
- 必须提供的参数
代码示例
API 请求 Google Suggestions 页面检索关键词 adidas 的建议。
{
"source": "google_suggest",
"query": "what is"
}curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_suggest", "query": "what is"}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_suggest',
'query': 'what is'
}
# 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 = array(
'source' => 'google_suggest',
'query' => 'what is'
);
$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 = array();
$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_suggest&query=what%20is&access_token=12345abcde以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
关键字
google_msv_v2 数据源将检索指定关键字和建议关键字的 Google 关键字数据(除非在上下文中传递 idea=False)。
查询参数
query
UTF 编码的关键词,用逗号分隔。
-
context:
language
语言,例如,英语 或 法文.没有参数或空值将返回所有语言的结果。
context:
currency
3 个符号的货币代码。
EUR
context:
ideas
如果是true,返回关键字的意思 ,如果是false,将只返回所请求关键字的数据。
true
context:
ideas_limit
当获取意思时,将检索意思关键字的数量限制为已有限制,四舍五入到最接近的 50 倍数(例如:20 -> 50, 123 -> 150).0 表示没有限制。
0
context:
min_amsv
在获取意思时,将过滤掉月平均搜索量低于所提供数字的意思关键词。0 表示没有过滤器。
0
context:
max_amsv
在获取意思时,将过滤掉月平均搜索量高于所提供数字的意思关键词。0 表示没有过滤器。
0
- 必须提供的参数
代码示例
在这个示例中,API 将检索优秀的 餐厅的关键词数据和所有建议的关键词。关键词语言是法文,地理位置为Paris,Ile-de-France,France 和货币是 EUR。
N/Acurl --user user:pass1 'https://data.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_msv_v2", "query": "meilleur restaurant", "geo_location": "Paris,Ile-de-France,France", "context": [{"key": "language", "value": "french"},{"key": "currency", "value": "EUR"}, {"key": "ideas", "value": true}]}'
# OR if you don't want ideas:
curl --user user:pass1 'https://data.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "google_msv_v2", "query": "meilleur restaurant", "geo_location": "Paris,Ile-de-France,France", "context": [{"key": "language", "value": "french"},{"key": "currency", "value": "EUR"}, {"key": "ideas", "value": false}]}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_msv_v2',
'query': 'meilleur restaurant',
'geo_location': 'Paris,Ile-de-France,France',
'context': [
{'key': 'language', 'value': 'french'},
{'key': 'currency', 'value': 'EUR'},
{'key': 'ideas', 'value': True}, # OR False if you don't want ideas.
],
}
# Get response.
response = requests.request(
'POST',
'https://data.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Print prettified response to stdout.
pprint(response.json())<?php
$params = array(
'source' => 'google_msv_v2',
'query' => 'meilleur restaurant',
'geo_location' => 'Paris,Ile-de-France,France',
'context' => array(
array('key' => 'language', 'value' => 'french'),
array('key' => 'currency', 'value' => 'EUR'),
array('key' => 'ideas', 'value' => true) // or 'value' => false if you don't want ideas
)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://data.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 = array();
$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);
?>样本输出(历史搜索量条目和意思条目将被剪切):
{
"results": [
{
"content":
{
"ideas": [
{
"cpc": 4.712038,
"keyword": "meilleur restaurant a paris",
"currency": "EUR",
"competition": 0.3385383889238515,
"averageSearchVolume": 1900,
"historicalSearchVolume": [
{
"date": "201803",
"searchVolume": 1600
},
{
"date": "201802",
"searchVolume": 1900
}]
}],
"seeds": [
{
"cpc": 4.05351,
"keyword": "meilleur restaurant",
"currency": "EUR",
"competition": 0.3385341239238515,
"averageSearchVolume": 2900,
"historicalSearchVolume": [
{
"date": "201803",
"searchVolume": 3600
},
{
"date": "201802",
"searchVolume": 2900
}]
}]
}
}]
}搜寻趋势:探索
google_trends_explore 来源旨在检索 Google 搜寻趋势的结果。
查询参数
query
UTF 编码的关键词,用逗号分隔。
-
geo_location
其结果应符合其地理位置。Google 搜寻趋势:探索,我们接受 2 个字母的 ISO 国家代码作为 geo_location 参数值。我们也允许使用 worldwide 作为 geo_location 的参数值。
-
context:search_type
让您设置搜索类型(Google Trends GUI 的其中一个选项)。可用值: web_search, image_search, google_shopping, youtube_search。
web_search
context:date_from
日期下限。格式: 年-月-日。 最早的可能日期: 2004-01-01。
context:date_to
日期上限。格式:年-月-日。最早的可能日期: 2004-01-01。
- 必须提供的参数
代码示例
在这个示例中,我们请求获得 2021 年 1 月 1 日至 2022 年 2 月 2 日之间adidas搜索词的趋势结果,并将类别设置为“艺术与娱乐”(类别 id:3)。
{
"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 = array(
'source' => 'google_search',
'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 = array();
$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以上示例使用了 Realtime 集成方法。如果您想在您的查询中使用一些其他集成方法(如推拉或代理端点),请参考集成方法部分。
Last updated
Was this helpful?

