Fix: correctly parse flight code

This commit is contained in:
sfigato 2022-09-07 22:17:22 +02:00
parent b115dd55a4
commit e916f8628b
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -97,9 +97,11 @@ class Details(object):
This function fills the fileds related to the flight code, This function fills the fileds related to the flight code,
if present and the input matches some heuristics. if present and the input matches some heuristics.
""" """
code = h5.text.strip("\t\n ") if "flight-numb" not in h5.attrib.get("class", ""):
if len(code) > 0 and "flight-numb" in h5.attrib.get("class", ""): return
self.code = code child = h5.xpath(".//strong")
if len(child) == 1:
self.code = child[0].text.strip("\t\n ")
def maybe_parse_airport(self, h5: et._ElementTree) -> None: def maybe_parse_airport(self, h5: et._ElementTree) -> None:
""" """