开始使用
参数字段说明
参数 | 类型 | 说明 |
---|---|---|
actor | string | 非常重要的参数,它代表一个服务。点击查看scraper actor列表信息 |
input | object | 提交actor需要的参数,完成一次数据抓取。 |
proxy | object | country字段,使用该地区的代理发送请求。 |
Input 字段说明
参数 | 类型 | 默认 | 说明 |
---|---|---|---|
url | string | 目标网站 | |
method | string | GET | 请求方式 |
redirect | boolean | false | 是否允许重定向 |
headers | object | 自定义请求头字段 |
发送第一个请求
抓取 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)