Fix: correctly parse flight code

master
blallo 2022-09-07 22:17:22 +02:00
parent b115dd55a4
commit e916f8628b
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
1 changed files with 5 additions and 3 deletions

View File

@ -97,9 +97,11 @@ class Details(object):
This function fills the fileds related to the flight code,
if present and the input matches some heuristics.
"""
code = h5.text.strip("\t\n ")
if len(code) > 0 and "flight-numb" in h5.attrib.get("class", ""):
self.code = code
if "flight-numb" not in h5.attrib.get("class", ""):
return
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:
"""