def recode_entities(title, charset):
output = []
for part in entity_re.split(title):
def recode_entities(title, charset):
output = []
for part in entity_re.split(title):
- if part not in ("&", "<", ">", ""e;") and \
+ if part not in ("&", "<", ">", """) and \
if log: log("Parser %s.%s failed, trying next one." % (p.__module__, p.__name__))
converted_title = title = parser.title
if log: log("Parser %s.%s failed, trying next one." % (p.__module__, p.__name__))
converted_title = title = parser.title
- final_title = recode_entities(converted_title, universal_charset)
- parts = [s.strip() for s in final_title.replace('\r', '').split('\n')]
- final_title = ' '.join([s for s in parts if s])
- if log and (final_title <> converted_title): log(" final title : %s" % final_title)
- parser.title = final_title
+ if title:
+ final_title = recode_entities(converted_title, universal_charset)
+ parts = [s.strip() for s in final_title.replace('\r', '').split('\n')]
+ final_title = ' '.join([s for s in parts if s])
+ if log and (final_title <> converted_title): log(" final title : %s" % final_title)
+ parser.title = final_title