$API_TOKEN=<YOUR_API_TOKEN>
$cat > input.json << 'EOF'
<{
< "requests": [
< {
< "url": "https://apify.com"
< }
< ],
< "pseudoUrls": [
< {
< "purl": "https://apify.com[(/[\\w-]+)?]"
< }
< ],
< "linkSelector": "a[href]",
< "pageFunction": "async function pageFunction(context) {\n const { window, document, crawler, enqueueRequest, request, response, userData, json, body, kvStore, customData } = context;\n\n const title = document.querySelector('title').textContent\n\n const responseHeaders = response.headers\n\n return {\n title,\n responseHeaders\n };\n}",
< "preNavigationHooks": "// We need to return array of (possibly async) functions here.\n// The functions accept two arguments: the \"crawlingContext\" object\n// and \"requestAsBrowserOptions\" which are passed to the `requestAsBrowser()`\n// function the crawler calls to navigate..\n[\n async (crawlingContext, requestAsBrowserOptions) => {\n // ...\n }\n]",
< "postNavigationHooks": "// We need to return array of (possibly async) functions here.\n// The functions accept a single argument: the \"crawlingContext\" object.\n[\n async (crawlingContext) => {\n // ...\n },\n]",
< "proxy": {
< "useApifyProxy": true
< },
< "additionalMimeTypes": [],
< "customData": {}
<}
<EOF
$curl "https://api.apify.com/v2/acts/mstephen190~vanilla-js-scraper/runs?token=$API_TOKEN" \
< -X POST \
< -d @input.json \
< -H 'Content-Type: application/json'