Bing
以下是我们通过 Bing 支持的所有可用数据
source
值的快速概览。来源 | 描述 | 结构化数据 |
---|---|---|
bing | 提交您喜欢的任意 Bing 网址。 | 否 |
bing_search | Bing SERPs. | 否 |
您可以通过选择菜单右侧的名称跳转至您首选的 Bing 页面类型。每个页面都包含参数表以及代码示例,可帮助您开始查询。
bing
源设计用于检索各种 Bing 页面直接 URL 中的内容。与其发送多个参数,您可以向我们提供所需 Bing 页面的直接 URL。我们不会剥离任何参数或以任何其他方式更改您的 URL。 - 必须提供的参数
在这个示例中,我们提出了一个请求,以检索所提供 URL 的一个结果。
JSON
cURL
Python
PHP
HTTP
{
"source": "bing",
"url": "https://www.bing.com/search?q=nike"
}
curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "bing", "url": "https://www.bing.com/search?q=nike"}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'bing',
'url': 'https://www.bing.com/search?q=nike'
}
# 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())
<?php
$params = array(
'source' => 'bing',
'url' => 'https://www.bing.com/search?q=nike'
);
$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://bing.com/search/?text=nike&
# Encoded URL: https%3A%2F%2Fbing.com%2Fsearch%2F%3Ftext%3Dnike%26
https://realtime.oxylabs.io/v1/queries?source=bing&url=https%3A%2F%2Fbing.com%2Fsearch%2F%3Ftext%3Dnike%26&access_token=12345abcde
bing_search
源设计用于检索 Bin 搜索结果页面(SERP)。参数 | 描述 | 默认值 |
---|---|---|
source | bing_search | |
domain | com | |
query | UTF 编码的关键字 | - |
start_page | 起始页数 | 1 |
pages | 检索的页数 | 1 |
limit | 每页中要检索的结果数。 | 10 |
locale | - | |
geo_location | 该 API 使用 Canonical Geo Location 格式来确定请求位置。具体如下: 城市、地区、国家 ,例如 Harrisburg,Arkansas,United States )。 | - |
user_agent_type | desktop | |
callback_url | - |
- 必须提供的参数
在以下示例中,我们提出了一个请求,以检索
10
个 Bing SERP,从第 11
页开始,搜索词为 adidas
。JSON
cURL
Python
PHP
HTTP
{
"source": "bing_search",
"query": "adidas",
"start_page": 11,
"pages": 10
}
curl --user user:pass1 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json"
-d '{"source": "bing_search", "domain": "com", "query": "adidas", "start_page": 11, "pages": 10, "callback_url": "https://your.callback.url"}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'bing_search',
'domain': 'com',
'query': 'adidas',
'start_page': 11,
'pages': 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' => 'bing_search',
'domain' => 'com',
'query' => 'adidas',
'start_page' => 11,
'pages' => 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=bing_search&domain=com&query=adidas&start_page=11&pages=10&access_token=12345abcdep