1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrls": [
12 {
13 "url": "https://weather.com/weather/today/l/5aea1d50a6d6b9e99cf89ba79f463d67dcf21ea5061990aae1ffc1c7fa8911a9"
14 },
15 {
16 "url": "https://weather.com/weather/today/l/ada030b2de8db495da2d93d5a2ecf30de1ce8b54cb09725d19c803543685646d"
17 }
18 ],
19 "locations": [
20 "Montgomery, Alabama",
21 "Juneau, Alaska"
22 ],
23 "locationIds": [
24 "e60256f3426acd3c1b3380921210fcffeab628a120c41d1de03b59a0f0dd32ad",
25 "bf217d537cc1c8074ec195ce07fb74de3c1593caa6033b7c3be4645ccc5b01de"
26 ],
27 "timeFrame": "today",
28 "units": "imperial",
29 "maxItems": 10,
30 "proxyConfiguration": {
31 "useApifyProxy": true
32 },
33 "extendOutputFunction": ($) => { return {} },
34 "customMapFunction": (object) => { return {...object} }
35};
36
37
38const run = await client.actor("epctex/weather-scraper").call(input);
39
40
41console.log('Results from dataset');
42console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48