カスタムクッキー
Wsa-Cookie リクエストヘッダーを送信することで、スクレイピングにカスタムクッキーを付加できます。APIは、ブラウザから送信する場合と全く同じ形でそれらのクッキーをターゲットサイトへ転送します。
Endpoint
Section titled “Endpoint” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Web Scraping APIキー |
url | string | yes | 取得対象のターゲットURL |
Wsa-Cookie (header) | string | no | セミコロン区切りのクッキー文字列。例: name1=value1; name2=value2。 |
Example request
Section titled “Example request”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());Example response
Section titled “Example response”{ "cookies": { "name1": "value1", "name2": "value2" }}