Baidu
可以使用直接 URL 或使用百度搜索栏的查询参数来定位百度。
baidu
可解析: 否
必需参数: url
可选参数: device_type, session_id
通过向 url 参数提供完整的百度 URL 来检索 百度 搜索引擎结果页面。在这种情况下,可以在 URL 本身中指定其他参数。
curl -u SPusername:SPpassword -X POST --url https://scraper-api.smartdaili-china.com/v2/scrape -H "Content-Type: application/json" -d "{\"target\": \"baidu\", \"url\": \"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=donuts&fenlei=256&rsv_pq=dc12cef9000cecd5&rsv_t=eb7dbdneGaOeG8buqmqpjMaLZ8tiygOJCtkEqqboaIRy1vnbiFlpef4ieJg&rqlang=cn&rsv_enter=1&rsv_dl=tb&rsv_sug3=6&rsv_sug1=1&rsv_sug7=100&rsv_sug2=0&rsv_btype=i&inputT=6940&rsv_sug4=6940\", \"parse\": \"False\"}"
import requests
task_params = {
'target': 'baidu',
'url': 'https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=donuts&fenlei=256&rsv_pq=dc12cef9000cecd5&rsv_t=eb7dbdneGaOeG8buqmqpjMaLZ8tiygOJCtkEqqboaIRy1vnbiFlpef4ieJg&rqlang=cn&rsv_enter=1&rsv_dl=tb&rsv_sug3=6&rsv_sug1=1&rsv_sug7=100&rsv_sug2=0&rsv_btype=i&inputT=6940&rsv_sug4=6940',
'parse': False
}
username = 'SPusername'
password = 'SPpassword'
response = requests.post(
'https://scraper-api.smartdaili-china.com/v2/scrape',
json = task_params,
auth = (username, password)
)
print(response.text)
<?php
$params = array(
'target' => 'baidu',
'url' => 'https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=donuts&fenlei=256&rsv_pq=dc12cef9000cecd5&rsv_t=eb7dbdneGaOeG8buqmqpjMaLZ8tiygOJCtkEqqboaIRy1vnbiFlpef4ieJg&rqlang=cn&rsv_enter=1&rsv_dl=tb&rsv_sug3=6&rsv_sug1=1&rsv_sug7=100&rsv_sug2=0&rsv_btype=i&inputT=6940&rsv_sug4=6940',
'parse' => False
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartdaili-china.com/v2/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'SPusername' . ':' . 'SPpassword');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
$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);
?>
baidu_search
可解析: 否
必需参数: query
可选参数: domain, page_from, num_pages, device_type, session_id
通过向查询参数提供你的查询来检索 百度 搜索引擎结果页面的 HTML。
curl -u SPusername:SPpassword -X POST --url https://scraper-api.smartdaili-china.com/v2/scrape -H "Content-Type: application/json" -d "{\"target\": \"baidu_search\", \"query\": \"donuts\", \"parse\": \"False\"}"
import requests
task_params = {
'target': 'baidu_search',
'query': 'donuts',
'parse': False
}
username = 'SPusername'
password = 'SPpassword'
response = requests.post(
'https://scraper-api.smartdaili-china.com/v2/scrape',
json = task_params,
auth = (username, password)
)
print(response.text)
<?php
$params = array(
'target' => 'baidu_search',
'query' => 'donuts',
'parse' => False
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://scraper-api.smartdaili-china.com/v2/scrape');
curl_setopt($ch, CURLOPT_USERPWD, 'SPusername' . ':' . 'SPpassword');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
$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);
?>
Updated 4 months ago