import requests def get_address_from_google_maps_url(url): """Retrieves the address from a Google Maps URL using the Places API. Args: url: The Google Maps URL. Returns: The address, if found. Otherwise, None. """ api_key = "AIzaSyDL1FJgeqIiNRHTA3nZTnJQBRpdqcOZu9A" request_url = "https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input={}&key={}".format( url, api_key) response = requests.get(request_url) if response.status_code == 200: data = response.json() print(data) if "results" in data and len(data["results"]) > 0: address = data["results"][0]["formatted_address"] return address return None if __name__ == "__main__": url = "https://maps.app.goo.gl/HDM1xXyyX9no6fk87" address = get_address_from_google_maps_url(url) if address: print("Address: {}".format(address)) else: print("No address found.")