1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "items": [
12 {
13 "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
14 "title": "A Light in the Attic",
15 "price": 51.77,
16 "stock": {
17 "available": true,
18 "count": 22
19 }
20 },
21 {
22 "url": "https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html",
23 "title": "Tipping the Velvet",
24 "price": 53.74,
25 "stock": {
26 "available": true,
27 "count": 20
28 }
29 },
30 {
31 "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
32 "title": "A Light in the Attic",
33 "price": 51.77,
34 "stock": {
35 "available": true,
36 "count": 22
37 }
38 },
39 {
40 "url": "https://books.toscrape.com/catalogue/soumission_998/index.html",
41 "title": "Soumission",
42 "price": 50.1,
43 "stock": {
44 "available": false,
45 "count": 0
46 }
47 },
48 {
49 "url": "HTTPS://BOOKS.TOSCRAPE.COM/catalogue/soumission_998/index.html",
50 "title": "Soumission (copy)",
51 "price": 50.1,
52 "stock": {
53 "available": false,
54 "count": 0
55 }
56 }
57 ],
58 "dedupFields": [
59 "url"
60 ],
61 "caseInsensitive": true
62};
63
64
65const run = await client.actor("innovative_cookie/dataset-merge-dedup").call(input);
66
67
68console.log('Results from dataset');
69console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
70const { items } = await client.dataset(run.defaultDatasetId).listItems();
71items.forEach((item) => {
72 console.dir(item);
73});
74
75