기본 요청
가장 단순한 Web Scraping API 호출에는 api_key와 대상 url, 단 두 개의 매개변수만 필요합니다. API는 페이지의 원본 HTML과 함께 요청을 설명하는 몇 가지 커스텀 응답 헤더를 반환합니다.
엔드포인트
섹션 제목: “엔드포인트” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>
매개변수
섹션 제목: “매개변수”| 매개변수 | 유형 | 필수 | 설명 |
|---|---|---|---|
api_key | string | 예 | Web Scraping API 키 |
url | string | 예 | 가져올 대상 URL |
사용자 지정 응답 헤더
섹션 제목: “사용자 지정 응답 헤더”API는 스크래핑에 성공할 때마다 WSA- 접두사가 붙은 몇 가지 응답 헤더를 추가합니다.
| Header | 설명 |
|---|---|
WSA-Client-Cookies | 대상 페이지 로드 후 JavaScript에 의해 생성되어 설정된 쿠키입니다. |
WSA-Scraped-Headers | 스크래핑된 URL이 반환한 응답 헤더입니다. |
WSA-Scraped-Resolved-Url | 리다이렉트 이후의 최종 URL입니다. |
WSA-Call-Credit-Usage | 이 요청에 소비된 크레딧입니다. |
WSA-Current-Credit-Usage | 이 요청 이후의 총 크레딧 사용량입니다. |
요청 예시
섹션 제목: “요청 예시”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());응답 예시
섹션 제목: “응답 예시”<!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>참고 항목
섹션 제목: “참고 항목”- API 요청 - 전체 매개변수 참조
- JavaScript 렌더링
- API 오류