investigate_raw_data.py•1.87 kB
#!/usr/bin/env python
"""Investigate what raw data is available from Google Flights."""
import sys
# Check what indices are available in the raw data by examining the parser
with open('/usr/local/lib/python3.11/dist-packages/fast_flights/parser.py', 'r') as f:
content = f.read()
print("=== Analysis of fast_flights parser ===\n")
print("The parser extracts the following indices from single_flight array:")
print(" [3] - from_airport code")
print(" [4] - from_airport name")
print(" [5] - to_airport name")
print(" [6] - to_airport code")
print(" [8] - departure time")
print(" [10] - arrival time")
print(" [11] - duration")
print(" [17] - plane_type")
print(" [20] - departure date")
print(" [21] - arrival date")
print()
print("The parser also extracts from flight[22] (extras):")
print(" extras[7] - carbon_emission")
print(" extras[8] - typical_carbon_emission")
print()
print("From the main flight array (k):")
print(" k[0] - flight data")
print(" k[1][0][1] - price")
print()
print("Other potentially available indices in single_flight that are NOT extracted:")
print(" [0], [1], [2], [7], [9], [12], [13], [14], [15], [16], [18], [19], etc.")
print()
print("These might contain:")
print(" - Flight numbers")
print(" - Airline codes")
print(" - Booking codes")
print(" - Other metadata")
print()
print("Similarly, k might have other data:")
print(" - is_best flag")
print(" - Additional pricing info")
print(" - etc.")
print()
print("CONCLUSION:")
print("The fast-flights 3.0rc0 library does NOT extract flight numbers or is_best flags.")
print("To get this data, we would need to:")
print(" 1. Fork and modify the fast-flights library")
print(" 2. Parse the raw HTML/JSON ourselves")
print(" 3. Request these features from the fast-flights maintainers")
print()
print("For now, these fields are NOT available through the library.")