1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "search",
12 "searchTerms": [
13 "harry potter"
14 ],
15 "sortBy": "relevance",
16 "onlyInStock": false,
17 "onlyOnSale": false,
18 "urls": [
19 "https://www.indigo.ca/products/harry-potter-and-the-philosopher-s-stone-25th-anniversary-edition",
20 "https://www.indigo.ca/products/harry-potter-and-the-philosopher-s-stone-25th-anniversary-edition?variant=46458034192594&utm_source=x",
21 "https://www.indigo.ca/en-ca/products/harry-potter-and-the-philosopher-s-stone-25th-anniversary-edition",
22 "https://www.indigo.ca/fr/products/harry-potter-and-the-philosopher-s-stone-25th-anniversary-edition",
23 "https://www.indigo.ca/collections/books",
24 "https://www.indigo.ca/search?q=harry+potter",
25 "https://m.indigo.ca/",
26 "https://www.chapters.indigo.ca/en-ca/books/product/9780547928227-item.html",
27 "https://www.indigo.ca/en-ca/search/?keywords=harry+potter"
28 ],
29 "fetchDetails": true,
30 "maxItems": 20,
31 "proxy": {
32 "useApifyProxy": true,
33 "apifyProxyGroups": [
34 "RESIDENTIAL"
35 ],
36 "apifyProxyCountry": "CA"
37 },
38 "incrementalMode": false,
39 "compactUpdates": false,
40 "emitUnchanged": false,
41 "emitExpired": false,
42 "ignoreFieldsForChanges": [
43 "rating",
44 "reviewCount",
45 "inventoryATS",
46 "availableInStores",
47 "storesInStockCount"
48 ],
49 "notifyOnlyChanges": false
50};
51
52
53const run = await client.actor("abotapi/indigo-ca-scraper").call(input);
54
55
56console.log('Results from dataset');
57console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
58const { items } = await client.dataset(run.defaultDatasetId).listItems();
59items.forEach((item) => {
60 console.dir(item);
61});
62
63