API phổ quátBắt đầu nhanhBắt đầu

Bắt đầu

Giải thích tham số

Tham sốKiểuMô tả
actorstringMột tham số rất quan trọng, nó đại diện cho một dịch vụ. Nhấp để xem thông tin danh sách actor scraper
inputobjectCác tham số cần thiết bởi actor để hoàn thành tác vụ thu thập dữ liệu.
proxyobjectTrường country, sử dụng proxy từ khu vực này để gửi yêu cầu.

Giải thích trường Input

Tham sốKiểuMặc địnhMô tả
urlstringWebsite mục tiêu
methodstringGETPhương thức yêu cầu
redirectbooleanfalseCho phép chuyển hướng hay không
headersobjectCác trường header yêu cầu tùy chỉnh

Gửi yêu cầu đầu tiên

Sử dụng việc thu thập dữ liệu của https://httpbin.io/get làm ví dụ.

Thu thập dữ liệu thông qua điểm cuối API

import requests
import json
 
API_KEY = ""
host = "api.scrapeless.com"
url = f"https://{host}/api/v1/unlocker/request"
 
payload = json.dumps({
   "actor": "unlocker.webunlocker",
   "input": {
      "url": "https://httpbin.io/get",
      "redirect": False,
      "method": "GET",
   },
   "proxy":{
       "country": "ANY",
   }
})
headers = {
   'Content-Type': 'application/json',
   'x-api-token': f'{API_KEY}'
}
 
response = requests.request("POST", url, headers=headers, data=payload)
 
print(response.text)