Small contribution , sometimes director in shows gives <EpImgFlag> as result so change this part to match the first matching director 's name
Code
director = re.findall('<Director>[|](.*?)[|]', output)
if not director:
director = re.findall('<Director>(.*?)[|]', output)
if not director:
director = re.findall('<Director>(.*?)</Director>', output)
to