import googlemaps import requests # Your Google Maps API Key api_key = 'AIzaSyDL1FJgeqIiNRHTA3nZTnJQBRpdqcOZu9A' # URL of the Google Maps link google_maps_url = 'https://maps.app.goo.gl/HDM1xXyyX9no6fk87' # Extract place ID from the URL using requests response = requests.get(google_maps_url) url_params = response.url.split('/') place_id = url_params[-1] # Initialize the Google Maps client gmaps = googlemaps.Client(api_key) # Use the place ID to retrieve the address details place_details = gmaps.place(place_id=place_id, fields=['name', 'formatted_address']) if place_details and 'name' in place_details and 'formatted_address' in place_details: name = place_details['name'] address = place_details['formatted_address'] print(f"Name: {name}") print(f"Address: {address}") else: print("Place details not found.")