• Builds
  • latest 0.0.1 / 2018-04-11
  • Created 2018-04-11
  • Last modified 2018-04-11
  • grade 2


Example act that opens a webpage with Golden Gate webcam stream. It takes a screenshot from the stream and saves it as output to key-value store. You can easily use it as API that returns a screenshot with:[YOUR_API_TOKEN]


To run the actor, send a HTTP POST request to:<YOUR_API_TOKEN>

The POST payload will be passed as input for the actor. For more information, read the docs.

Example input

Content type: application/json; charset=utf-8

{ "hello": 123 }

Source code

Based on the apify/actor-node-chrome Docker image (see docs).

const Apify = require('apify');

Apify.main(async () => {
    const browser = await Apify.launchPuppeteer();

    // Load and get an iframe
    // containing webcam stream.
    const page = await browser.newPage();
    await page.goto('');
    const iframe = (await page.frames()).pop();

    // Get webcam image element handle.
    const imageElementHandle = await iframe.$('.VideoColm img');

    // Get a screenshot of that image.
    const imageBuffer = await imageElementHandle.screenshot();

    // Save it as an output.
    await Apify.setValue('OUTPUT', imageBuffer, { contentType: 'image/jpeg' });