1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "action": "scrapeData",
12 "url": "https://wordpress.org/plugins/?plugin_business_model=commercial",
13 "columnMappings": [
14 {
15 "key": "name",
16 "value": "2"
17 },
18 {
19 "key": "link",
20 "value": "0"
21 },
22 {
23 "key": "ratings",
24 "value": "4"
25 },
26 {
27 "key": "authorName",
28 "value": "8"
29 },
30 {
31 "key": "usersCount",
32 "value": "9"
33 },
34 {
35 "key": "description",
36 "value": "6"
37 },
38 {
39 "key": "lastUpdated",
40 "value": "11"
41 },
42 {
43 "key": "pluginLogo",
44 "value": "1"
45 }
46 ],
47 "tableNumber": 1,
48 "nextPageSelector": ".next.page-numbers",
49 "count": 100,
50 "minDelay": 2,
51 "maxDelay": 2
52};
53
54
55const run = await client.actor("curious_coder/instant-web-scraper").call(input);
56
57
58console.log('Results from dataset');
59console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
60const { items } = await client.dataset(run.defaultDatasetId).listItems();
61items.forEach((item) => {
62 console.dir(item);
63});
64
65