Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 2.29 KB

File metadata and controls

85 lines (64 loc) · 2.29 KB

JavaScript (apify-client) — Google Flights Scraper

Call the Google Flights Scraper from Node.js with the official apify-client.

Install

npm install apify-client

Search and read the flights

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('logiover/google-flights-scraper').call({
  origin: 'JFK',
  destination: 'LHR',
  departureDate: '2026-08-15',
  tripType: 'one-way',
  seatClass: 'economy',
  currency: 'USD',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Fetched ${items.length} itineraries`);

for (const f of items) {
  console.log(`${f.airlines} · ${f.price} ${f.currency} · ${f.stops} stop(s) · ` +
    `${f.fromCode}→${f.toCode} ${f.departureTime}-${f.arrivalTime}`);
}

Build a cheapest-day fare calendar

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('logiover/google-flights-scraper').call({
  origin: 'JFK',
  destination: 'LHR',
  departureDate: '2026-08-01',
  departureDateEnd: '2026-08-31',
  currency: 'USD',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

// cheapest price per departure date
const byDay = {};
for (const f of items) {
  const d = f.departureDate;
  if (!byDay[d] || f.price < byDay[d]) byDay[d] = f.price;
}
console.table(byDay);

Price-drop check (round-trip, business)

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('logiover/google-flights-scraper').call({
  origin: 'IST',
  destination: 'DXB',
  departureDate: '2026-09-10',
  returnDate: '2026-09-17',
  tripType: 'round-trip',
  seatClass: 'business',
  currency: 'EUR',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
const cheapest = items.reduce((a, b) => (a.price < b.price ? a : b));
console.log('Cheapest:', cheapest.price, cheapest.currency, 'on', cheapest.airlines);

📄 Documentation only. ▶️ Run it: https://apify.com/logiover/google-flights-scraper