기본 요청
가장 단순한 Web Scraping API 호출에는 api_key와 대상 url, 단 두 개의 매개변수만 필요합니다. API는 페이지의 원본 HTML과 함께 요청을 설명하는 몇 가지 커스텀 응답 헤더를 반환합니다.
Endpoint
섹션 제목: “Endpoint” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>
Parameters
섹션 제목: “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Web Scraping API 키 |
url | string | yes | 가져올 대상 URL |
Custom response headers
섹션 제목: “Custom response headers”API는 스크래핑에 성공할 때마다 WSA- 접두사가 붙은 몇 가지 응답 헤더를 추가합니다.
| Header | Description |
|---|---|
WSA-Client-Cookies | 대상 페이지 로드 후 JavaScript에 의해 생성되어 설정된 쿠키입니다. |
WSA-Scraped-Headers | 스크래핑된 URL이 반환한 응답 헤더입니다. |
WSA-Scraped-Resolved-Url | 리다이렉트 이후의 최종 URL입니다. |
WSA-Call-Credit-Usage | 이 요청에 소비된 크레딧입니다. |
WSA-Current-Credit-Usage | 이 요청 이후의 총 크레딧 사용량입니다. |
Example request
섹션 제목: “Example request”curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com"import requests
r = requests.get("https://scrape.shifter.io/v1", params={ "api_key": "YOUR_API_KEY", "url": "https://example.com",})print(r.text)import fetch from 'node-fetch';
const url = 'https://scrape.shifter.io/v1?' + new URLSearchParams({ api_key: 'YOUR_API_KEY', url: 'https://example.com',});const res = await fetch(url);console.log(await res.text());Example response
섹션 제목: “Example response”<!doctype html><html><head> <title>Example Domain</title></head><body><div> <h1>Example Domain</h1> <p>This domain is for use in illustrative examples in documents.</p> <p><a href="https://www.iana.org/domains/example">More information...</a></p></div></body></html>See also
섹션 제목: “See also”- API 요청 - 전체 매개변수 참조
- JavaScript 렌더링
- API 오류