Realtime
Oxylabs 的 网页爬虫API 的 Realtime 集成。从任务提交到返回结果或错误,始终保持 HTTPS 连接开启,并使用 JSON 格式的负载。
任务提交
端点
POST https://realtime.oxylabs.io/v1/queries输入
curl --user "USERNAME:PASSWORD" \
'https://realtime.oxylabs.io/v1/queries' \
-H "Content-Type: application/json" \
-d '{"source": "universal", "url": "https://example.com", "geo_location": "United States"}'import requests
from pprint import pprint
# Structure payload.
payload = {
"source": "universal", # 你选择的来源,例如 "universal"
"url": "https://example.com", # 查看你所使用的特定来源的文档,以确定应使用 "url" 还是 "query"
"geo_location": "United States", # 某些来源接受邮政编码和/或坐标
#"render" : "html", # 如果你想在页面上渲染 JavaScript,请取消注释
#"render" : "png", # Uncomment if you want to take a screenshot of a scraped web page
#"parse" : true, # Check what sources support parsed data
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('YOUR_USERNAME', 'YOUR_PASSWORD'), #Your credentials go here
json=payload,
)
# 不返回作业状态和结果 URL 的响应,而是返回
# 带有结果的 JSON 响应。
pprint(response.json())输出
渲染参数
解析参数
默认输出
可用输出
输出示例:
最后更新于
这有帮助吗?

