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 "iphone"
14 ],
15 "urls": [
16 "https://24h.pchome.com.tw/search/iphone",
17 "https://24h.pchome.com.tw/search/?q=iphone",
18 "https://24h.pchome.com.tw/category/DYAJ95C",
19 "https://24h.pchome.com.tw/prod/DYAJ01-A900J9CU7",
20 "https://24h.pchome.com.tw/prod/DYAJ01-A900J9CU7?fq=/S/DYAJ01&utm_source=x",
21 "https://24h.pchome.com.tw/store/DYAJ01",
22 "https://24h.pchome.com.tw/region/DYAJ",
23 "https://24h.pchome.com.tw/sign/mobile",
24 "https://24h.pchome.com.tw/sites/sandisk",
25 "https://m.pchome.com.tw/"
26 ],
27 "maxReviews": 20,
28 "proxy": {
29 "useApifyProxy": true
30 },
31 "incrementalMode": false,
32 "emitExpired": false,
33 "compactUpdates": false,
34 "expireAfterMissedScans": 1,
35 "ignoreFieldsForChanges": []
36};
37
38
39const run = await client.actor("abotapi/pchome-24h-scraper").call(input);
40
41
42console.log('Results from dataset');
43console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49