feat: extract rating, review count and category (completes #11) - #15
Conversation
Completes the remaining scope of #11 (coordinates already shipped in #13): - Place gains rating: Option<f32>, reviews_count: Option<u32>, category: Option<String>. - extract_place_details reads them from the detail panel with defensive, multi-selector fallbacks (EN/DE), keeping review count separate from the rating via keyword/parenthesis targeting. - Pure, unit-tested parse_rating (locale-tolerant decimal, 0–5 range check) and parse_reviews_count (strips thousands separators) helpers. - Drive-by: fix two doc comments that had drifted onto the wrong fn. Note: the DOM selectors could not be validated against a live Chrome in this environment; the parsing logic is fully unit-tested and the selectors are best-effort with fallbacks — they may need real-world tuning. README/CHANGELOG updated. https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR extends Place with optional fields ChangesRicher Place Data Extraction
Sequence DiagramsequenceDiagram
participant search_many
participant extract_place_details
participant DOM
participant parse_helpers
participant PlaceDetailRaw
participant Place
search_many->>extract_place_details: request place detail extraction
extract_place_details->>DOM: inject JS to read rating/reviews/category
DOM-->>extract_place_details: raw extracted strings (rating, reviews, category)
extract_place_details->>parse_helpers: pass rating string
parse_helpers-->>extract_place_details: Option<f32> parsed rating
extract_place_details->>parse_helpers: pass reviews string
parse_helpers-->>extract_place_details: Option<u32> parsed reviews_count
extract_place_details->>PlaceDetailRaw: store parsed values
search_many->>Place: enrich Place with PlaceDetailRaw fields
Place-->>search_many: enriched Place returned
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib.rs`:
- Around line 636-642: parse_reviews_count currently takes the first numeric
token (via REVIEWS_RE.find) which mis-parses strings like "4.7 stars from 1,234
reviews"; update it to pick the numeric token nearest a review keyword instead.
Change parse_reviews_count to: use REVIEWS_RE.find_iter(text) to gather all
numeric tokens (with their byte positions), normalize each token to digits only,
locate a review-keyword match (e.g., regex or simple case-insensitive search for
"review", "reviews", "rating", "ratings", "votes") and choose the numeric token
whose position is closest to that keyword; if no keyword is found, fall back to
the current first-match behavior and return digits.parse().ok(); keep REVIEWS_RE
and function signature the same and ensure no panics on parse failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 28a92d14-b5e6-47a2-9181-b36dfab4cc5b
📒 Files selected for processing (3)
CHANGELOG.mdREADME.mdsrc/lib.rs
Address CodeRabbit review on #15: parse_reviews_count took the first numeric token, so a combined label like "4.7 stars from 1,234 reviews" yielded 47 instead of 1234. Now prefer the number adjacent to a review keyword (reviews/rezensionen/bewertungen), then a parenthesised count, then any number. Adds combined-label regression tests (EN + DE). https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
…flicts) - lib.rs: keep check_proxy from main alongside the new rating/reviews/ category extraction - CHANGELOG: move the rating/reviews/category entry from the (now shipped) 0.2.0 section to Unreleased Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHcB7Dhren7PSwn4va8BKv
Implements the three issues from today's improvement-research run (#52, #53, #54) plus live-validation of the DOM selectors added in #15 (bakeries, hotels via a real proxied Chrome session): - Place::place_id / Place::cid — stable Google identifiers parsed from the maps URL's data= blob (no new navigation, no new DOM selectors). Live-confirmed against real listings. - ScraperConfig::language (default Some("en")) — pins the Maps UI language via hl= on every navigation, so extraction no longer silently degrades behind non-EN/DE exit geos. Live-confirmed: addresses now read "Germany"/category "Bakery" instead of the proxy-geo language. - Place, ScraperConfig, and Error are now #[non_exhaustive], so future Option<T> fields / error variants land in minor releases instead of forcing a breaking bump every time. ScraperConfig is built via default() + field mutation; README updated accordingly. Bug found and fixed during live validation: chromiumoxide's arg() builder prepends "--" itself, but MapsScraper::launch was passing already-dashed strings ("--proxy-server=...", "--user-agent=...", "--disable-blink-features=...", "--lang=...", "--window-size=..."), double-prefixing them to "----proxy-server=..." etc. Chrome silently ignores unrecognized flags, so every one of these was a no-op — including the proxy, which is a real leak (the documented protection against a malformed proxy value did not cover this: the whole flag was malformed, not just the value). Fixed by passing bare (key, value) tuples per chromiumoxide's actual API. Also, live validation surfaced a genuine Google Maps DOM change: reviews_count is no longer shown inline next to the rating for most listing types (bakeries) as of 2026-07-30, though it's still present for others (hotels) via a body-text fallback added here. Documented honestly on the field instead of pretending it reliably works. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHcB7Dhren7PSwn4va8BKv
Overview
Completes the remaining scope of #11 (coordinates already shipped in #13).
Placenow also carries the rating, review count, and business category from the Google Maps detail panel.What changed
Placegains three fields (allOption, backwards-compatible):rating: Option<f32>— average star rating (0.0–5.0)reviews_count: Option<u32>— number of reviewscategory: Option<String>— primary business categoryextract_place_detailsreads them from the panel with defensive, multi-selector fallbacks (EN + DE). Review count is targeted via review-keywordaria-label/ a parenthesised count so it stays separate from the rating.parse_rating— accepts,or.decimals ("4,5","4.5 stars","4,5 Sterne"), enforces the 0–5 range.parse_reviews_count— strips thousands separators (.,,, spaces, non-breaking spaces):"1,234 reviews","1.234 Rezensionen","(1 234)"→1234.This environment has no local Chrome, so the DOM selectors could not be verified against live Google Maps. The risk is contained:
Option, so a missed selector yieldsNone, never a crash).They may need real-world tuning. Now that Browserless support exists (#12), the selectors can be validated against real Google Maps via a remote Chrome (
BROWSERLESS_URL) — happy to do a follow-up tuning pass once an endpoint is available.Test plan
cargo buildcargo test(8 passed)cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningsBROWSERLESS_URL)Addresses #11.
https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
Generated by Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests