amzSear v3: Updated selectors, ASIN-based API, product details, reviews, and modern dependencies - #37
Open
v1b3coder wants to merge 14 commits into
Open
amzSear v3: Updated selectors, ASIN-based API, product details, reviews, and modern dependencies#37v1b3coder wants to merge 14 commits into
v1b3coder wants to merge 14 commits into
Conversation
…on HTML Fixes asherAgs#10 Fixes asherAgs#14 Fixes asherAgs#16 Fixes asherAgs#17 Fixes asherAgs#19 Fixes asherAgs#27
…, lxml_html_clean, requests)
Add CLI flag -P/--product to fetch product details directly by ASIN, bypassing search. Includes new AmzProductDetails, AmzReviews, and selectors modules for parsing product pages. Supports all output formats (short, verbose, JSON, CSV). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add single fetch_html() function in core/__init__.py used by both AmzSear (search) and AmzProduct (product details). Remove duplicate request code and consolidate headers into REQUEST_HEADERS constant. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace UUID (DOM element ID) with ASIN as collection key - Deduplicate search results by ASIN, keeping first occurrence - Display ASIN column in search output - The -i flag now accepts ASIN for item selection UUID was Amazon's internal DOM identifier with no practical use. ASIN is the universal product identifier that works with -P flag. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CLI changes:
- -i/--item accepts both ASIN and numeric index (0-based position)
- Replace -d/--dont-open with -b/--browser (browser no longer opens by default)
- CSV output uses 'asin' as first column instead of legacy '_index'
- Add -P/--product documentation to help text
Bug fixes:
- Fix missing 'elif' for verbose output handler
- Fix typo in comment ('quite' -> 'quiet')
Documentation:
- Update README.md with ASIN-based output examples
- Update docs/cli/README.md with new flags and examples
- Add Example 7 for direct product lookup by ASIN
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace -P/--product with -a/--asin for ASIN lookup - Replace -i/--item with -s/--select for result selection - Update documentation to reflect new flag names Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace -o {short,verbose,json} with independent -v and -j flags
- -v shows full details, -j outputs JSON, combinable as -v -j
- Remove CSV and quiet output formats
- Fix verbose output: full-length values, proper formatting
- Fix region bug: pass region to AmzProduct for correct domain URLs
- Update documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace silent None returns in fetch_html with explicit FetchError exceptions. Store fetch errors in AmzProduct._fetch_error and display them in CLI output instead of silently showing no data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix shared mutable class attribute bug in AmzBase (_all_attrs) - Fix incorrect fallback import paths in AmzBase.py and AmzRating.py - Switch from urllib to requests for HTTP requests - Add @functools.wraps to decorators to preserve metadata - Fix None/True comparisons (use 'is None' and truthy checks) - Fix division by zero risk in AmzRating.get_perc() - Fix inefficient __len__ in AmzBase (use generator) - Move docstrings inside functions per Python convention - Add --version/-V flag to CLI - Add exit codes and error handling to CLI - Add __version__ to package - Fix regex escape warnings (use raw strings) - Remove unused lxml.html.clean import - URL-encode query strings in build_url() for security - Bump version to 2.0.2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The products variable was being reassigned on each loop iteration instead of accumulating results. Now uses extend() to collect products from all pages. Bump version to 3.0.1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fork brings amzSear up to date with modern Amazon and modern Python. It fixes broken search functionality, adds the ability to look up products by ASIN, and introduces new classes for fetching detailed product information and customer reviews.
Note: This PR is a superset of changes from #35 by @Foadsf, which served as the starting point. On top of those fixes, this branch adds further updates, new features, and a refined CLI.
What's New
It Works Again
urllibtorequests, with proper headers and timeoutsNew: Look Up Any Product by ASIN
You can now fetch detailed product information directly:
This returns the brand, full title, product bullet points, technical specifications, review count, average rating, and image URLs — all extracted from the product page.
New: Customer Reviews
A new
AmzReviewsclass lets you extract customer review data programmatically: reviewer name, star rating, review text, date, verified purchase status, helpful votes, and attached images.CLI Improvements
-a/--asin— look up a product directly by ASIN-v/--verboseand-j/--json— simpler flags replace the old--outputoption-b/--browser— open the product page in your browser (replaces the inverted--dont-open)--version— see the installed versionNew Region Support
Under the Hood
selectors.pyfile for easier maintenanceBreaking Changes
rget()for positional access as before.--outputis replaced by-vand-jflags; CSV export has been removed (use-jfor JSON instead).-i/--itemrenamed to-s/--select.-d/--dont-openreplaced by-b/--browser(inverted logic — now you opt in to opening the browser).