Skip to content

Instantly share code, notes, and snippets.

@0xjgv
Last active December 23, 2017 20:20
Show Gist options
  • Save 0xjgv/df4582f0ef7e49c2a811ea23c647932f to your computer and use it in GitHub Desktop.
Save 0xjgv/df4582f0ef7e49c2a811ea23c647932f to your computer and use it in GitHub Desktop.
const Apify = require('apify');
const request = require('request-promise');
Apify.main(async () => {
// Get input of your act
const input = await Apify.getValue('INPUT');
console.log('My input:');
console.dir(input);
// Do something useful here
const html = await request('http://www.example.com');
// And then save output
const output = {
html,
crawledAt: new Date(),
};
console.log('My output:');
console.dir(output);
await Apify.setValue('OUTPUT', output);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment