diff --git a/fast_flights/core.py b/fast_flights/core.py index 977b241e..c8fab395 100644 --- a/fast_flights/core.py +++ b/fast_flights/core.py @@ -269,6 +269,10 @@ def safe(n: Optional[LexborNode]): # Get prices price = safe(item.css_first(".YMlIz.FpEdX")).text() or "0" + # Get flight number (from the flight details section) + # Flight numbers appear in spans like "F9 1230" or "UA 820" + flight_number = safe(item.css_first("span.Xsgmwe")).text(strip=True) or None + # Stops formatting try: stops_fmt = 0 if stops == "Nonstop" else int(stops.split(" ", 1)[0]) @@ -286,6 +290,7 @@ def safe(n: Optional[LexborNode]): "stops": stops_fmt, "delay": delay, "price": price.replace(",", ""), + "flight_number": flight_number, } ) diff --git a/fast_flights/schema.py b/fast_flights/schema.py index a5572d6d..950b67ef 100644 --- a/fast_flights/schema.py +++ b/fast_flights/schema.py @@ -21,3 +21,4 @@ class Flight: stops: int delay: Optional[str] price: str + flight_number: Optional[str] = None