JavaScript instructions
Pass a URL-encoded JSON array of browser actions to js_instructions. The API runs them in order before returning the final HTML. Useful for paginated lists, infinite scroll, and form-driven flows.
Endpoint
Section titled “Endpoint” GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>&render_js=1&js_instructions=<URL_ENCODED_JSON>
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Your Web Scraping API key |
url | string | yes | Target URL to fetch |
js_instructions | string | yes | URL-encoded JSON array of action objects. |
render_js | integer | yes | Must be 1. |
Action object
Section titled “Action object”| Field | Type | Description |
|---|---|---|
action | string | One of click, scrollTo, focus, value, or submit (forms only). |
selector | string | CSS selector for the target element. |
timeout | integer | Milliseconds to wait after this action completes. |
Example request
Section titled “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
Section titled “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>