1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "legs": [
12 {
13 "origin": "JFK",
14 "destination": "LHR",
15 "date": "2027-03-10"
16 },
17 {
18 "origin": "LHR",
19 "destination": "CDG",
20 "date": "2027-03-14"
21 },
22 {
23 "origin": "CDG",
24 "destination": "JFK",
25 "date": "2027-03-18"
26 }
27 ],
28 "origins": [
29 "JFK"
30 ],
31 "destinations": [
32 "LHR"
33 ],
34 "departureDate": "",
35 "returnDate": "",
36 "proxyConfiguration": {
37 "useApifyProxy": true
38 }
39};
40
41
42const run = await client.actor("famed_bonobo/google-flights-scraper").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52