参数说明

瞭解 Thordata 的 Universal Scraping 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?