Amazon metadata download: Handle books whose titles start with a bracket. Fixes #976365 (metadata not importing)

This commit is contained in:
Kovid Goyal 2012-04-08 12:40:02 +05:30
parent a4147c00fd
commit ea2e70f502

View File

@ -347,7 +347,10 @@ class Worker(Thread): # Get details {{{
method='text').strip() method='text').strip()
else: else:
title = self.tostring(tdiv, encoding=unicode, method='text').strip() title = self.tostring(tdiv, encoding=unicode, method='text').strip()
return re.sub(r'[(\[].*[)\]]', '', title).strip() ans = re.sub(r'[(\[].*[)\]]', '', title).strip()
if not ans:
ans = title.rpartition('[')[0].strip()
return ans
def parse_authors(self, root): def parse_authors(self, root):
x = '//h1[contains(@class, "parseasinTitle")]/following-sibling::span/*[(name()="a" and @href) or (name()="span" and @class="contributorNameTrigger")]' x = '//h1[contains(@class, "parseasinTitle")]/following-sibling::span/*[(name()="a" and @href) or (name()="span" and @class="contributorNameTrigger")]'