バイナリファイル
APIに2MB未満の任意のバイナリファイル(画像、PDF、音声など)のURLを指定すると、ファイルをデータURIとしてエンコードしたbase64_stringキーを含むJSONオブジェクトを返します。
エンドポイント
Section titled “エンドポイント” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<BINARY_FILE_URL>&binary_response=1
パラメーター
Section titled “パラメーター”| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
api_key | string | はい | あなたのWeb Scraping APIキー |
url | string | はい | 取得するバイナリファイルのURL。 |
binary_response | integer | いいえ | バイナリレスポンス形式を強制する場合は1を設定します。 |
リクエスト例
Section titled “リクエスト例”curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2F2%2F2f%2FGoogle_2015_logo.svg%2F440px-Google_2015_logo.svg.png"import requests
r = requests.get("https://scrape.shifter.io/v1", params={ "api_key": "YOUR_API_KEY", "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/440px-Google_2015_logo.svg.png", "binary_response": 1,})print(r.json()["base64_string"][:80])import fetch from 'node-fetch';
const url = 'https://scrape.shifter.io/v1?' + new URLSearchParams({ api_key: 'YOUR_API_KEY', url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/440px-Google_2015_logo.svg.png', binary_response: '1',});const res = await fetch(url);const data = await res.json();console.log(data.base64_string.slice(0, 80));レスポンス例
Section titled “レスポンス例”{ "base64_string": "data:image/webp;base64,UklGRlobAABXRUJQVlA4TE4bAAA..."}- Web Scraping API - エンドポイントハブ
- Basic request