daasmartphone.blogg.se

Google maps scraper mac
Google maps scraper mac









google maps scraper mac

With open('restaurant_data.json', 'w') as f:Īsync with async_playwright() as playwright:

google maps scraper mac

# waiting for results to be displayed on the pageĪwait page.wait_for_selector('div') # Click Īwait page.locator("").click()Īwait page.locator("input").fill(search_term)Īwait page.locator("button").click() Search_term = "dentist in New York City, NY, USA" Main function which launches browser instance and performs browserīrowser = await ( Phone = await result_elem.locator(phone_selector).inner_text()Īsync def run(playwright: Playwright) -> None: Review_count = review_raw.replace('(', '').replace(')', '')Īddress = await result_elem.locator(address_selector).inner_text() Title = await result_elem.locator(title_selector).inner_text() # iterating through all the displayed resultsįor result_idx in range(await unt()): Results = page.locator(result_container_selector) Phone_selector = 'div.W4Efsd div.W4Efsd:nth-of-type(2) span[jsins' \ Title_selector = '.fontHeadlineSmall span'Īddress_selector = 'div.W4Efsd div.W4Efsd:nth-of-type(1) span[jsinstance' \ Title, review count, rating, address of various results From playwright.async_api import Playwright, async_playwrightįrom playwright.async_api import TimeoutError as PlaywrightTimeoutErrorĮxtracts the results information from the pageĪ list containing details of results as dictionary.











Google maps scraper mac