参数说明

了解 Thordata 的 通用抓取 API - 抓取参数。

Token(必填):

该参数定义了爬取时使用的 API 令牌。对于您的成功爬取起到决定性作用。

参数
名称
作用

token

Token

爬取时验证的 API 令牌

URL(必填):

该参数定义了爬取的目的网站链接,默认值为 google.com。您也可以更改为其他搜索引擎链接。

参数
名称
作用

url

URL

爬取的目的网站的链接

示例请求:

带有token:Token ,url:https://www.google.com 的参数示例

curl -X POST https://universalapi.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True"

js_renderJS渲染(非必填)

JS渲染能够处理动态加载的内容和单页应用(SPA),支持更交互复杂的页面和渲染需求,建议您开启。

js_render=True

js_render=False

示例请求:

带有 js_render:True 的参数示例

curl -X POST https://universalapi.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True"
type输出格式(非必填)

该参数定义了抓取结果的输出格式。可选择HTML和PNG格式,默认为HTML。

format=HTML

format=PNG

示例请求:

带有 type:png 的参数示例

curl -X POST https://universalapi.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=png" -d "js_render=True"
headerHeader(非必填)

启用后,输出结果中会包含请求头的信息

示例请求:

带有 header:Ture 的参数示例

curl -X POST https://universalapi.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=True" \
 -d "header=True"
block_resources阻止(非必填)

该参数可限止不必要的资源抓取,从而加快抓取速度。

block_resources=图片

block_resources=Javascript脚本

示例请求:

带有block_resources:script 的参数示例

curl -X POST https://universalapi.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True" -d "block_resources=script"
country国家/地区(非必填)

该参数定义了爬取时的代理使用哪个国家/地区,默认值无代理。

country=随机

country=任意国家代码

示例请求:

带有 country:al 的参数示例

curl -X POST https://universalapi.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True" -d "country=al"

Last updated

Was this helpful?