1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "code":
12
13
14 async function pageFunction(context) {
15
16
17
18
19
20 const $ = context.jQuery;
21 const pageTitle = $('title').first().text();
22
23
24 context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);
25
26
27 context.enqueueRequest({ url: 'http://www.example.com' });
28
29
30
31 return {
32 url: context.request.url,
33 pageTitle
34 };
35 }
36};
37
38
39const run = await client.actor("drobnikj/js-code-2-flowchart").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49