自定义Cookie
通过发送 Wsa-Cookie 请求标头,可以为抓取附加自定义 cookie。API 会将这些 cookie 原样转发给目标网站,就像你在浏览器中发送它们一样。
Endpoint
Section titled “Endpoint” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
api_key | string | 是 | 你的 Web Scraping API 密钥 |
url | string | 是 | 要抓取的目标 URL |
Wsa-Cookie(标头) | string | 否 | 以分号分隔的 cookie 字符串,例如 name1=value1; name2=value2。 |
curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=http%3A%2F%2Fhttpbin.org%2Fcookies" \ -H "Wsa-Accept: application/json" \ -H "Wsa-Cookie: name1=value1; name2=value2"import requests
r = requests.get( "https://scrape.shifter.io/v1", params={"api_key": "YOUR_API_KEY", "url": "http://httpbin.org/cookies"}, headers={ "Wsa-Accept": "application/json", "Wsa-Cookie": "name1=value1; name2=value2", },)print(r.json())import fetch from 'node-fetch';
const url = 'https://scrape.shifter.io/v1?' + new URLSearchParams({ api_key: 'YOUR_API_KEY', url: 'http://httpbin.org/cookies',});const res = await fetch(url, { headers: { 'Wsa-Accept': 'application/json', 'Wsa-Cookie': 'name1=value1; name2=value2', },});console.log(await res.json());{ "cookies": { "name1": "value1", "name2": "value2" }}