JavaScript 지침
js_instructions에 브라우저 액션의 URL 인코딩된 JSON 배열을 전달하십시오. API는 최종 HTML을 반환하기 전에 이 액션들을 순서대로 실행합니다. 페이지네이션된 목록, 무한 스크롤, 폼 기반 흐름에 유용합니다.
Endpoint
섹션 제목: “Endpoint” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>&render_js=1&js_instructions=<URL_ENCODED_JSON>
Parameters
섹션 제목: “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Web Scraping API 키 |
url | string | yes | 가져올 대상 URL |
js_instructions | string | yes | 액션 객체의 URL 인코딩된 JSON 배열입니다. |
render_js | integer | yes | 1이어야 합니다. |
Action object
섹션 제목: “Action object”| Field | Type | Description |
|---|---|---|
action | string | click, scrollTo, focus, value, submit(폼 전용) 중 하나입니다. |
selector | string | 대상 요소에 대한 CSS 선택자입니다. |
timeout | integer | 이 액션이 완료된 후 대기할 밀리초입니다. |
Example request
섹션 제목: “Example request”[{"action":"scrollTo","selector":"div.navFooterBackToTop","timeout":5000,"block":"start"}]curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com&render_js=1&js_instructions=%5B%7B%22action%22%3A%22scrollTo%22%2C%22selector%22%3A%22div.navFooterBackToTop%22%2C%22timeout%22%3A%205000%2C%20%22block%22%3A%20%22start%22%7D%5D"import jsonimport requests
instructions = [{ "action": "scrollTo", "selector": "div.navFooterBackToTop", "timeout": 5000, "block": "start",}]r = requests.get("https://scrape.shifter.io/v1", params={ "api_key": "YOUR_API_KEY", "url": "https://example.com", "render_js": 1, "js_instructions": json.dumps(instructions),})print(r.text)import fetch from 'node-fetch';
const instructions = [{ action: 'scrollTo', selector: 'div.navFooterBackToTop', timeout: 5000, block: 'start',}];const url = 'https://scrape.shifter.io/v1?' + new URLSearchParams({ api_key: 'YOUR_API_KEY', url: 'https://example.com', render_js: '1', js_instructions: JSON.stringify(instructions),});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></div></body></html>