1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "origin": "DEL",
12 "destination": "BOM",
13 "tripType": "ONE_WAY",
14 "departureDate": "AUTO",
15 "adults": 1,
16 "children": 0,
17 "infantsInSeats": 0,
18 "maxStops": 2,
19 "maxRetries": 2,
20 "maxOutboundSelections": 2,
21 "maxReturnOptions": 5,
22 "maxResults": 10,
23 "cabinClass": "ECONOMY",
24 "flightType": "ALL",
25 "locale": "en",
26 "country": "IN"
27};
28
29
30const run = await client.actor("aiconsulting/google-flights-scraper-v2").call(input);
31
32
33console.log('Results from dataset');
34console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
35const { items } = await client.dataset(run.defaultDatasetId).listItems();
36items.forEach((item) => {
37 console.dir(item);
38});
39
40