This JavaScript code imports various modules and sets constants for a project directory, then defines two functions, getLocations
and getLocation
, which respectively retrieve a list of locations and extract specific data from each location's webpage. The getLocation
function makes a GET request to a URL, extracts XPath expressions for elements containing day names, times, and deals, and then maps the results to an object with dotw
, time
, and deals
properties.
This code uses Selenium to scrape location names and descriptions from Google Maps search results, handling pagination to retrieve all available data. It then prepares the data for further processing or storage, likely in JSON format.
Cell 2The code imports necessary modules and functions, sets environment variables, and defines two main functions: loadLocations()
and getAllLocationsData()
. These functions interact with file systems, Google Maps, and Selenium to load and update locations data, which is then written to a JSON file.