Closed Arlexg closed 1 year ago
Thanks! Those features are useful, will integrate them later.
Advice: try to not use @aria-label in xpaths because Google Maps displays the language of the browser. In your case it's in Spanish (example: Mostrar el horario de la semana). If another is using another language, it won't work!
"""This script serves as an example on how to use Python & Playwright to scrape/extract data from Google Maps"""
from playwright.sync_api import sync_playwright from dataclasses import dataclass, asdict, field import pandas as pd import argparse from typing import List
@dataclass class Business: """holds business data """ name: str = None image: str = None category: str = None address: str = None website: str = None phone_number: str = None reviews_count: int = None reviews_average: float = None horario: List[str] = None
@dataclass class BusinessList: """holds list of Business objects, and save to both excel and csv """ business_list: list[Business] = field(default_factory=list)
def main():
if name == "main":