View source: R/scrape-google.R
| google_maps | R Documentation | 
Scrape Google Maps' reviews
google_maps(
  client,
  name,
  place_id = NULL,
  base = "https://www.google.com/maps/search/?api=1&query=",
  sleep = 1,
  max_reviews = 100,
  result_id = 1,
  with_text = FALSE
)
client | 
 
  | 
name | 
 String with the name of the target place.  | 
place_id | 
 String with the unique ID of the target place, useful when more than one place has the same name.  | 
base | 
 String with the base URL for Google Maps website.  | 
sleep | 
 Integer with number of seconds to use as pause between actions on the web page.  | 
max_reviews | 
 Integer with the maximum number of reviews to scrape. The number of existing reviews will define the actual number of reviews returned.  | 
result_id | 
 Integer with the result position to use, only relevant when
multiple matches for the given   | 
with_text | 
 Boolean value to indicate if the   | 
Tibble with the reviews extracted from Google Maps.
## Not run: 
# Create RSelenium session
rD <- RSelenium::rsDriver(browser = "firefox", port = 4544L, verbose = FALSE)
# Retrieve reviews for Sefton Park in Liverpool
sefton_park_reviews_tb <-
  scrappy::google_maps(
    client = rD$client,
    name = "Sefton Park",
    place_id = "ChIJrTCHJVkge0gRm1LWF0fSPgw",
    max_reviews = 20
  )
sefton_park_reviews_tb_with_text <-
  scrappy::google_maps(
    client = rD$client,
    name = "Sefton Park",
    place_id = "ChIJrTCHJVkge0gRm1LWF0fSPgw",
    max_reviews = 20,
    with_text = TRUE
  )
# Stop server
rD$server$stop()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.