mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[PR #463] [MERGED] Update Audible scraper to be more strict about what it considers an ASIN and a valid ASIN query response #3357
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf/pull/463
Author: @selfhost-alt
Created: 4/16/2022
Status: ✅ Merged
Merged: 4/18/2022
Merged by: @advplyr
Base:
master← Head:strict-asin-check📝 Commits (3)
d6c5b6eImplement a stricter check for possible ASIN values in titlescdcfd01Only consider an Audible ASIN query successful if the response contains an author2fc60e4Handle an undefined publisher_summary when querying Audible📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
server/providers/Audible.js(+3 -3)📄 Description
When doing a scrape of my library, I noticed the following exception in the logs.
This appears to be due to the fact that the Audible scraper found a sequence of 10 capital letters in the book title "GOLDEN RENDEZVOUS" and assumed that meant the title was an ASIN.
Then the secondary problem is that Audible's API apparently returns a 200 even when it gets an invalid ASIN. The response looks like this:
So the Audible scraper tries to parse the response and chokes because most of the fields are missing (specifically it fails when trying to remove HTML tags from the
publisher_summary.This diff addresses these issues with two changes. First it makes the ASIN matching regex more strict so it will only match a title that is exactly 10 capitalized alpha-numeric characters. Second, it only considers the ASIN query response to be successful if it returns an
authorsfield. That seemed like the most likely field to always be present in a valid response, but I'm happy to update that to something else if preferred.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.