Skip to content

Commit

Permalink
Amazon metadata download: Get title and comments for audiobook pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jun 23, 2024
1 parent 9425701 commit 61abe65
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/calibre/ebooks/metadata/sources/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ def sanitize_title(title):
for child in h1.xpath('./*[contains(@class, "a-color-secondary")]'):
h1.remove(child)
return sanitize_title(self.totext(h1))
# audiobooks
elem = root.xpath('//*[@id="productTitle"]')
if elem:
return sanitize_title(self.totext(elem[0]))
tdiv = root.xpath('//h1[contains(@class, "parseasinTitle")]')
if not tdiv:
span = root.xpath('//*[@id="ebooksTitle"]')
Expand Down Expand Up @@ -767,7 +771,11 @@ def parse_comments(self, root, raw):
ns = tuple(self.selector('#bookDescription_feature_div .a-expander-content'))
if ns:
ans = self._render_comments(ns[0])

# audiobooks
if not ans:
elem = root.xpath('//*[@id="audible_desktopTabbedDescriptionOverviewContent_feature_div"]')
if elem:
ans = self._render_comments(elem[0])
desc = root.xpath(
'//div[@id="productDescription"]/*[@class="content"]')
if desc:
Expand Down Expand Up @@ -1082,7 +1090,7 @@ def parse_language(self, pd):
class Amazon(Source):

name = 'Amazon.com'
version = (1, 3, 8)
version = (1, 3, 9)
minimum_calibre_version = (2, 82, 0)
description = _('Downloads metadata and covers from Amazon')

Expand Down

0 comments on commit 61abe65

Please sign in to comment.