Changes: - Early detection for "no reviews" messages in 11 languages - Checks for disabled reviews tabs and 0-review indicators - Returns early (saves 30-40s) when no reviews exist - Frontend hides analytics/export buttons when reviews_count = 0 - Structural pattern matching improvements (work in progress) Known issue: - Lithuanian hospital page has different structure (no tabs found) - Needs separate investigation - may use different Google Maps layout Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Open the page and keep it open for manual inspection.
|
|
INSTRUCTIONS:
|
|
1. Open DevTools (F12)
|
|
2. Click on an individual review
|
|
3. Look at the div that contains ONE review (not the whole list)
|
|
4. Note the class names on that div
|
|
"""
|
|
|
|
import time
|
|
from seleniumbase import Driver
|
|
|
|
url = "https://www.google.com/maps/search/?api=1&query=panevezio%20respubliikine%20ligonine&hl=en"
|
|
|
|
driver = Driver(uc=True, headless=False)
|
|
|
|
try:
|
|
driver.get(url)
|
|
time.sleep(5)
|
|
|
|
# GDPR
|
|
try:
|
|
form_btns = driver.find_elements('css selector', 'form button')
|
|
for btn in form_btns:
|
|
if 'accept all' in (btn.text or '').lower():
|
|
btn.click()
|
|
time.sleep(2)
|
|
break
|
|
except:
|
|
pass
|
|
|
|
# Click reviews tab
|
|
time.sleep(2)
|
|
tabs = driver.find_elements('css selector', 'button[role="tab"]')
|
|
for tab in tabs:
|
|
if 'review' in (tab.text or '').lower() or 'review' in (tab.get_attribute('aria-label') or '').lower():
|
|
driver.execute_script("arguments[0].click();", tab)
|
|
time.sleep(5)
|
|
break
|
|
|
|
# Scroll to load a few reviews
|
|
try:
|
|
pane = driver.find_element('css selector', 'div.m6QErb.WNBkOb.XiKgde')
|
|
for _ in range(5):
|
|
driver.execute_script("arguments[0].scrollBy(0, 300);", pane)
|
|
time.sleep(0.5)
|
|
except:
|
|
pass
|
|
|
|
print("\n" + "="*80)
|
|
print("MANUAL INSPECTION TIME!")
|
|
print("="*80)
|
|
print("\n1. The browser is now showing the reviews page")
|
|
print("2. Open DevTools (F12 or right-click > Inspect)")
|
|
print("3. Click the 'Select element' tool (top-left of DevTools)")
|
|
print("4. Hover over an INDIVIDUAL review (not the whole panel)")
|
|
print("5. Click on it to select it in the inspector")
|
|
print("6. Look at the <div> that wraps ONE SINGLE review")
|
|
print("7. Note the 'class' attribute value")
|
|
print("\n8. The class might look like: class=\"MyWpvb fontBodyMedium\" or similar")
|
|
print("\n9. Write down the full class name(s) - we'll use this as the selector!")
|
|
print("\n" + "="*80)
|
|
print("Browser will stay open for 5 minutes...")
|
|
print("="*80)
|
|
|
|
time.sleep(300) # 5 minutes
|
|
|
|
finally:
|
|
driver.quit()
|