1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "searchTerms": [
12 "cashmere jumper"
13 ],
14 "urls": [
15 "https://www.marksandspencer.com/pure-cashmere-crew-neck-jumper/p/clp61223565",
16 "https://www.marksandspencer.com/pure-cashmere-crew-neck-jumper/p/clp61223565?color=NAVY",
17 "https://www.marksandspencer.com/search?searchTerm=cashmere+jumper",
18 "https://www.marksandspencer.com/search?searchTerm=cashmere+jumper&page=2",
19 "https://www.marksandspencer.com/search?searchTerm=cashmere+jumper&sort=PRICE_LOW_TO_HIGH",
20 "https://www.marksandspencer.com/search?searchTerm=jumper&department=Womens",
21 "https://www.marksandspencer.com/l/women/knitwear",
22 "https://www.marksandspencer.com/l/women/knitwear/jumpers",
23 "https://www.marksandspencer.com/l/women/knitwear?page=2",
24 "https://www.marksandspencer.com/l/women/knitwear?department=Womens&sort=NEW",
25 "https://www.marksandspencer.com/l/brands/jaeger/womens",
26 "https://marksandspencer.com/l/women/knitwear"
27 ],
28 "proxy": {
29 "useApifyProxy": true
30 }
31};
32
33
34const run = await client.actor("abotapi/marksandspencer-scraper").call(input);
35
36
37console.log('Results from dataset');
38console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
39const { items } = await client.dataset(run.defaultDatasetId).listItems();
40items.forEach((item) => {
41 console.dir(item);
42});
43
44