Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extract_by_title(self, element):
title_list = element.xpath('//title/text()')
if not title_list:
return ''
title = re.split(TITLE_SPLIT_CHAR_PATTERN, title_list[0])
if title:
return title[0]
else:
return ''