通用抓取API快速入门入门

开始使用

参数字段说明

参数类型说明
actorstring非常重要的参数,它代表一个服务。点击查看scraper actor列表信息
inputobject提交actor需要的参数,完成一次数据抓取。
proxyobjectcountry字段,使用该地区的代理发送请求。

Input 字段说明

参数类型默认说明
urlstring目标网站
methodstringGET请求方式
redirectbooleanfalse是否允许重定向
headersobject自定义请求头字段

发送第一个请求

抓取 https://httpbin.io/get 数据为示例

通过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)