Skip to content

fix(amazon): Fix Amazon metadata search#707

Merged
crocodilestick merged 5 commits intocrocodilestick:mainfrom
jgoguen:amazon-search-fix
Oct 27, 2025
Merged

fix(amazon): Fix Amazon metadata search#707
crocodilestick merged 5 commits intocrocodilestick:mainfrom
jgoguen:amazon-search-fix

Conversation

@jgoguen
Copy link
Contributor

@jgoguen jgoguen commented Oct 20, 2025

Amazon search for metadata has been returning HTTP 503. This appears to fix that for amazon.com. Also makes some changes to the attributes searched for to accommodate Amazon changes.

This may fix #701

@redskull1986
Copy link

Hello,

thank you for the fix. I've tested it and it works, somehow.

I didn't get any ratings.

I've hardcoded the rating for testing:

                    try:
                        match.rating = 3
                    except (AttributeError, ValueError):
                        match.rating = 0
                    try:

but still no rating.

@jgoguen
Copy link
Contributor Author

jgoguen commented Oct 21, 2025

I checked the rating fetch and it did need updating I pushed a new commit with that and a couple other fixes, but it still isn't in the UI. Checking with log.debug(match.rating) shows it's being set correctly, could it be something isn't making it to the UI or isn't being used?

@jgoguen
Copy link
Contributor Author

jgoguen commented Oct 21, 2025

Looking at cps/templates/book_edit.html it looks like this is where the modal dialog is defined, but I don't see anything that would show the rating.

@redskull1986
Copy link

redskull1986 commented Oct 21, 2025

I found in cps/static/js/get_meta.js

// Removed as users can't fetch ratings from metadata providers // $("#rating").data("rating").setValue(Math.round(book.rating));

I don't know, when it was changed.

If I uncomment it. CWA don't display the rating, but it save it.

@jgoguen
Copy link
Contributor Author

jgoguen commented Oct 22, 2025

It might be better to do the UI all in a separate PR then. I know I don't save the rating from metadata fetching, I wouldn't want it to be enabled without any way to disable it.

Amazon search for metadata has been returning HTTP 503. This appears to fix that
for `amazon.com`. Also makes some changes to the attributes searched for to
accommodate Amazon changes.

This may fix crocodilestick#701
Fix getting the rating, series info, identifiers, and high-res cover image.
Ignores some non-book and pre-order pages, resilient against pages with no rating yet, and do better getting the description.
- URL construction now handles both /path and path formats
- Uses lxml parser (faster) with html.parser fallback
- Added null checks for description DOM navigation
- Added info-level logging when no results found
- Series parsing uses regex pattern matching, handles variations
@crocodilestick crocodilestick merged commit 6a4b85f into crocodilestick:main Oct 27, 2025
4 checks passed
@crocodilestick
Copy link
Owner

Thank you both for all your work on this! Merging both PRs now :)

@jgoguen jgoguen deleted the amazon-search-fix branch October 28, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Can't get Metadata from Amazon

3 participants