Probe Resources Plus Webhook
Under maintenance
Pricing
Pay per usage
Go to Store
Probe Resources Plus Webhook
Under maintenance
Calls jancurn/probe-page-resources and then invokes a hard-coded webhook. The act takes same input as jancurn/probe-page-resources
0.0 (0)
Pricing
Pay per usage
1
Total users
4
Monthly users
2
Runs succeeded
0%
Last modified
3 years ago
Dockerfile
# This is a template for a Dockerfile used to run acts in Actor system.# The base image name below is set during the act build, based on user settings.# IMPORTANT: The base image must set a correct working directory, such as /usr/src/app or /home/userFROM apify/actor-node-basic:v0.21.10
# Second, copy just package.json and package-lock.json since it should be# the only file that affects "npm install" in the next step, to speed up the buildCOPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --only=prod --no-optional \ && echo "Installed NPM packages:" \ && (npm list --all || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version
# Copy source code to container# Do this in the last step, to have fast build if only the source code changedCOPY . ./
# NOTE: The CMD is already defined by the base image.# Uncomment this for local node inspector debugging:# CMD [ "node", "--inspect=0.0.0.0:9229", "main.js" ]
package.json
{ "name": "apify-project", "version": "0.0.1", "description": "", "author": "It's not you it's me", "license": "ISC", "dependencies": { "underscore": "latest", "apify": "0.21.10", "request-promise": "latest" }, "scripts": { "start": "node main.js" }}
main.js
1const _ = require('underscore');2const Apify = require('apify');3const request = require('request-promise');4
5Apify.main(async () => {6 const input = await Apify.getValue('INPUT');7 console.log('Calling jancurn/probe-page-resources with input:');8 console.log(JSON.stringify(input, null, 2));9 10 const run = await Apify.call('jancurn/probe-page-resources', input);11 12 // console.log(JSON.stringify(run,null,2));13 console.dir(run.output);14 for (let rec of run.output) {15 console.dir(rec); 16 17 // Test webhook, review the calls at http://mockbin.org/bin/b652e23e-5e5e-4904-8fc1-c55dcd7f6ee1/log18 if (rec.url === 'https://www.example.com/') {19 console.log('Testing webhook');20 21 const options = {22 method: 'POST',23 uri: 'http://mockbin.org/bin/b652e23e-5e5e-4904-8fc1-c55dcd7f6ee1',24 json: true,25 body: {26 "csp-report": {27 "blocked-uri": "https://a.postrelease.com/serve/load.js",28 "document-uri": "https://www.perf.webmd.com/allergies/default.htm",29 "referrer": "",30 "violated-directive": " apifier-rpt-networkerr",31 "effective-directive": "apifier-rpt",32 "original-policy": "",33 "disposition": "apifier-rpt",34 "status-code": "404/Failed/Blocked/etc – HTTP Status Code",35 'mime-type': 'application/x-javascript',36 'type': 'script',37 'method' : 'GET',38 "script-sample": "",39 "source-file": "https://a.postrelease.com/serve/load.js"40 }41 }42 };43 await request(options);44 }45 }46});