1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrls": [
12 {
13 "url": "https://apify.com/pricing"
14 }
15 ],
16 "instructions": "List each pricing plan with its name and monthly price in USD.",
17 "outputSchema": {
18 "type": "object",
19 "properties": {
20 "plans": {
21 "type": "array",
22 "items": {
23 "type": "object",
24 "properties": {
25 "name": {
26 "type": "string"
27 },
28 "monthlyPriceUsd": {
29 "type": [
30 "number",
31 "null"
32 ]
33 }
34 },
35 "required": [
36 "name"
37 ]
38 }
39 }
40 },
41 "required": [
42 "plans"
43 ]
44 },
45 "maxPages": 3
46};
47
48
49const run = await client.actor("conserving_celerytop/ai-web-scraper").call(input);
50
51
52console.log('Results from dataset');
53console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54const { items } = await client.dataset(run.defaultDatasetId).listItems();
55items.forEach((item) => {
56 console.dir(item);
57});
58
59