网络爬虫API
定位 可用目标 列表中未列出的网站
你可以使用universal
参数作为目标并提供你想要的任何 URL,这将返回目标 URL 的 HTML。
针对 ip.smartproxy.com
网站的代码示例(仅更改授权详细信息):
import requests
url = "https://scraper-api.smartdaili-china.com/v1/tasks"
payload = {
"target": "universal",
"headless": "html",
"url": "https://ip.smartproxy.com"
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Base64 encoded user:pass"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://scraper-api.smartdaili-china.com/v1/tasks', [
'body' => '{"target":"universal","headless":"html","url":"https://ip.smartproxy.com"}',
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Base64 encoded user:pass',
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Base64 encoded user:pass'
},
body: JSON.stringify({target: 'universal', headless: 'html', url: 'https://ip.smartproxy.com'})
};
fetch('https://scraper-api.smartdaili-china.com/v1/tasks', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
curl --request POST \
--url https://scraper-api.smartdaili-china.com/v1/tasks \
--header 'Accept: application/json' \
--header 'Authorization: Base64 encoded user:pass' \
--header 'Content-Type: application/json' \
--data '
{
"target": "universal",
"headless": "html",
"url": "https://ip.smartproxy.com"
}
'
上述代码的结果:
一旦你拥有有效的网络订阅,你将能够检查生成的代理用户名,并在身份验证方法选项卡中设置所需的密码。
你可以尝试通过我们的 API 游乐场 发送请求,为请求选择所需的参数。在这种情况下,目标将始终是通用。
你还将在屏幕右侧看到生成的curl 请求的示例。
Updated 12 months ago