-3

I have been searching how can I obtain the description of each place of Google Maps, because Google Place doesn't offer the description. I wanted to know if it is possible to scrape the description of each place with JAVA. It will be only for didactic objectives. I enclose a photo.

https://subefotos.com/ver/?4337c39301538269fe1c47ca48906c90o.png"

Thank you.

2 Answers2

1

Please note that scraping of data from maps.google.com might be against the Terms of Service of the product, with regards to your concern, you are correct that the feature is currently not available in Google Maps APIs and there is already a Feature Request that was filed for this feature, I also see that you have + 1'd to the issue in order to receive updates, for other developers that wants this feature to be incorporated in the Google Maps Platform APIs, you may also star the issue here - https://issuetracker.google.com/35822953 to receive updates.

Please also note that the best place for feature requests for Google Maps Platform APIs are to file it in the Issue Tracker in order for the engineers to review the feasibility of your requests.

Shawn Domingo
  • 1,371
  • 1
  • 11
  • 16
1

You can query a link: https://www.google.com/maps/place/data=!4m5!3m4!1s{DATA_ID}!8m2!3d{latitude}!4d{longitude}?hl=en

  • DATA_ID: e.g. 0x89c259a61c75684f%3a0x79d31adb123348d2

If you then inspect the page source, you'll see that all of the data is located inside the window.APP_INITIALIZATION_STATE block, which contains all of the maps data (including the descriptions you are interested in). You would just have to parse it.

Alternatively, you can also use a third party solution like SerpApi. It's a paid API with a free trial.

Example java code (available in other libraries also):

Map<String, String> parameter = new HashMap<>();

parameter.put("api_key", "secret_api_key");
parameter.put("engine", "google_maps");
parameter.put("google_domain", "google.com");
parameter.put("hl", "en");
parameter.put("data", "!4m5!3m4!1s0x89c259a61c75684f%3a0x79d31adb123348d2!8m2!3d40.7457413!4d-73.98820049999999");
parameter.put("type", "place");

GoogleSearch search = new GoogleSearch(parameter);

try
{
  JsonObject results = search.getJson();
}
catch (SerpApiClientException ex)
{
  Console.WriteLine("Exception:");
  Console.WriteLine(ex.ToString());
}

Example JSON output:

{
  "place_results": {
    "title": "Stumptown Coffee Roasters",
    "data_id": "0x89c259a61c75684f:0x79d31adb123348d2",
    "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c259a61c75684f%3A0x79d31adb123348d2",
    "gps_coordinates": {
      "latitude": 40.7457399,
      "longitude": -73.9882272
    },
    "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259a61c75684f%3A0x79d31adb123348d2%218m2%213d40.7457399%214d-73.9882272&engine=google_maps&google_domain=google.com&hl=en&type=place",
    "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOcnxJgzyrk5HzIJES2am5zeGjwzo2oMQt_tNMj=w114-h86-k-no",
    "rating": 4.6,
    "reviews": 1335,
    "price": "$$",
    "type": [
      "Coffee shop",
      "Cafe",
      "Coffee store",
      "Tea store"
    ],
    "description": "Coffee bar serving direct-trade java. Coffee bar chain offering house-roasted direct-trade coffee, along with brewing gear & whole beans",
    "service_options": {
      "takeout": true,
      "delivery": false
    },
    "extensions": [
      {
        "highlights": [
          "Fast service",
          "Fireplace",
          "Great coffee",
          "Great tea selection",
          "Live performances"
        ]
      },
      {
        "popular_for": [
          "Solo dining",
          "Good for working on laptop"
        ]
      },
      {
        "accessibility": [
          "Wheelchair accessible entrance",
          "Wheelchair accessible restroom"
        ]
      },
      {
        "offerings": [
          "Coffee",
          "Quick bite"
        ]
      },
      {
        "dining_options": [
          "Lunch",
          "Dinner",
          "Dessert"
        ]
      },
      {
        "amenities": [
          "Restroom"
        ]
      },
      {
        "atmosphere": [
          "Casual",
          "Cozy"
        ]
      },
      {
        "crowd": [
          "College students",
          "Tourists"
        ]
      },
      {
        "payments": [
          "NFC mobile payments"
        ]
      }
    ],
    "address": "18 W 29th St, New York, NY 10001",
    "website": "https://www.stumptowncoffee.com/locations/newyork/ace-nyc",
    "phone": "(855) 711-3385",
    "hours": [
      {
        "saturday": "8AM–4PM"
      },
      {
        "sunday": "8AM–4PM"
      },
      {
        "monday": "7AM–3PM"
      },
      {
        "tuesday": "7AM–3PM"
      },
      {
        "wednesday": "7AM–3PM"
      },
      {
        "thursday": "7AM–3PM"
      },
      {
        "friday": "7AM–3PM"
      }
    ],
    "images": [
      {
        "title": "All",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOcnxJgzyrk5HzIJES2am5zeGjwzo2oMQt_tNMj=w397-h298-k-no"
      },
      {
        "title": "Menu",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipO-7FZuS6-BQu_HrJN4qZ7fjC-mhpnfLCpPhXN-=w529-h298-k-no"
      },
      {
        "title": "Food & drink",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPCPSYLktGESHtVoEyffOsnYxtzyMjR1WjTbHPV=w397-h298-k-no"
      },
      {
        "title": "Vibe",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOVJ8ipbrVb7ct8_ssjdsWncKJBUUBux2QAK0ws=w397-h298-k-no"
      },
      {
        "title": "Street View & 360°",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipN_Slp5SIECK4LgVKUWCSmzL99kCEsJmDqZz-Rc=w224-h298-k-no-pi-18.172167-ya190.9134-ro3.5189135-fo100"
      },
      {
        "title": "Videos",
        "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOOPV7oy7w5070nMraA3lpk8GpV0GiE0rYHUW9S=w224-h398-k-no"
      }
    ],
    "user_reviews": {
      "summary": [
        {
          "snippet": "\"The baristas here are pretty cool people who pull excellent espresso shots.\""
        },
        {
          "snippet": "\"Nice space and good varied of coffee, drinks, baked goods and good service :)\""
        },
        {
          "snippet": "\"It has amazing food at affordable prices and the staff is super friendly.\""
        }
      ],
      "most_relevant": [
        {
          "username": "HerbertTomlinson O",
          "rating": 4,
          "description": "Finally, I found the best coffee shop today. Their choice of music is usually blasting from the past which was really relaxing and made me stay longer. There are tables for lovers and also for group of friends. The coffees and foods here are very affordable and well worth the money. You can't go wrong with this coffee shop. This is very worth to visit.",
          "date": "2 months ago"
        },
        {
          "username": "Izaac Collier",
          "rating": 5,
          "description": "I am not into coffee but one of my friends invited me here. As I looked the menu, I was convinced, so I ordered one for me. The food was tasty and the staff were very friendly and accommodating. The ambience was very cosy and comfortable. The coffee was great and super tasty. I will recommend this and will visit again!",
          "date": "a month ago"
        },
        {
          "username": "Kristin Franco",
          "rating": 5,
          "description": "The ambience was very cozy and comfortable. The coffee was great. Even if it was my first time to drink their coffee, I could really appreciate the taste and it became my favorite flavor then. I will recommend and will visit again. Thank you so much for the accommodating staff!",
          "date": "2 months ago"
        },
        {
          "username": "Jodi Maldonado",
          "rating": 4,
          "description": "You're the brightest of the bunch! This coffee shop appeals to me because it serves coffee and pastries that I love. It's not great, but it's not bad either. You've put in a lot of effort to earn the right to be remembered by a large number of people! Expect me to return and tell my coworkers about your idea.",
          "date": "3 months ago"
        },
        {
          "username": "Poppie Hodge",
          "rating": 5,
          "description": "Nice coffee bar! Looking for a nice coffee and cake for my parents, and I found this coffee shop near my house. Coffee and cakes were so sweet, and the staff are very polite and supportive. The place is so relaxing and so clean. Highly suggested to all of you!",
          "date": "2 months ago"
        },
        {
          "username": "Elba Haire",
          "rating": 4,
          "description": "Great biscuits, very good omelette, and the corned beef hash was the best!!! Wife had eggs Benedict and that was excellent too. Not much atmosphere but who cares when your face is buried in your plate!! Recommend strongly. Moderate prices, good value.",
          "date": "3 months ago"
        },
        {
          "username": "Tea Maldonado",
          "rating": 5,
          "description": "It's clean, well run, and the owners are genuinely nice people. A highly recommendable coffee shop!",
          "date": "3 weeks ago"
        },
        {
          "username": "Blanche Bibbins",
          "rating": 4,
          "description": "We shared the Reuben as recommended by the waitress. It was tasty and a perfect size to share. If you are looking for an interesting place for a quick lunch in the historic district of New york, this is a good place to try.",
          "date": "3 months ago"
        }
      ]
    },
    "people_also_search_for": [
      {
        "search_term": "Coffee shops",
        "local_results": [
          {
            "position": 1,
            "title": "Culture Espresso",
            "data_id": "0x89c259aa4c38ca75:0x88ca3d6ff537d876",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c259aa4c38ca75%3A0x88ca3d6ff537d876",
            "gps_coordinates": {
              "latitude": 40.7520746,
              "longitude": -73.9857387
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259aa4c38ca75%3A0x88ca3d6ff537d876%218m2%213d40.7520746%214d-73.9857387&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.5,
            "reviews": 1031,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOfqz4XRKZLCTff5ZIAT5CnwAMivcRhzvw6TYqA=w152-h152-k-no-pi0-ya240-ro0-fo100",
            "type": [
              "Coffee shop",
              "Bakery",
              "Cookies"
            ]
          },
          {
            "position": 2,
            "title": "Café Grumpy - Fashion District",
            "data_id": "0x89c259ab6335319b:0x394cadbea63ab640",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c259ab6335319b%3A0x394cadbea63ab640",
            "gps_coordinates": {
              "latitude": 40.7541667,
              "longitude": -73.98888889999999
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259ab6335319b%3A0x394cadbea63ab640%218m2%213d40.7541667%214d-73.98888889999999&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.4,
            "reviews": 549,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNDP9YNNEkQbsYghI0nueHm6u7GsouIErVSbrwk=w152-h152-n-k-no",
            "type": [
              "Coffee shop",
              "Cafe",
              "Espresso bar"
            ]
          },
          {
            "position": 3,
            "title": "Gregorys Coffee",
            "data_id": "0x89c259a72946c6f5:0xf883630efdc8c731",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c259a72946c6f5%3A0xf883630efdc8c731",
            "gps_coordinates": {
              "latitude": 40.740965599999996,
              "longitude": -73.9855511
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259a72946c6f5%3A0xf883630efdc8c731%218m2%213d40.740965599999996%214d-73.9855511&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.3,
            "reviews": 494,
            "thumbnail": "http://lh6.googleusercontent.com/proxy/qR76zBM64Gj706wDlRH2xgKfaAExaRw3xMGLGRuZwGXPxkCR23iZwkrLCR8wrCEMEPWSx_OLhLQUEToJXc7vYWuG28Nz_bFqGZWrRZQ-4raYVAa59Q1HOIWwxeBkSbsdbZvmbcsIjZ2_AFMEPKyhTlCoe5IQ2reO9hVNM-1k8V0i=w152-h152-n-k-no",
            "type": [
              "Coffee shop"
            ]
          },
          {
            "position": 4,
            "title": "Blue Bottle Coffee",
            "data_id": "0x89c258feda68c787:0xe0c78830b997f960",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c258feda68c787%3A0xe0c78830b997f960",
            "gps_coordinates": {
              "latitude": 40.758208599999996,
              "longitude": -73.9786889
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c258feda68c787%3A0xe0c78830b997f960%218m2%213d40.758208599999996%214d-73.9786889&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.5,
            "reviews": 742,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipN7oWsSBqHHQC-33qoVXOj78zYG1DWTyB4hwhMh=w152-h152-n-k-no",
            "type": [
              "Coffee shop"
            ]
          }
        ]
      },
      {
        "search_term": "Coffee roasters",
        "local_results": [
          {
            "position": 1,
            "title": "Irving Farm New York",
            "data_id": "0x89c259a1c4280bdf:0xb7d1c448bc0e0f46",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c259a1c4280bdf%3A0xb7d1c448bc0e0f46",
            "gps_coordinates": {
              "latitude": 40.736810299999995,
              "longitude": -73.9869409
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259a1c4280bdf%3A0xb7d1c448bc0e0f46%218m2%213d40.736810299999995%214d-73.9869409&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.2,
            "reviews": 528,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipN8U4YuUu1pS9PxWeJ-C6BcuKz-fo7pGX1qJ3Gk=w152-h152-n-k-no",
            "type": [
              "Coffee shop"
            ]
          },
          {
            "position": 2,
            "title": "Oslo Coffee Roasters",
            "data_id": "0x89c258c73391d667:0xc36a558319ee87cc",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c258c73391d667%3A0xc36a558319ee87cc",
            "gps_coordinates": {
              "latitude": 40.7691558,
              "longitude": -73.953699
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c258c73391d667%3A0xc36a558319ee87cc%218m2%213d40.7691558%214d-73.953699&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.6,
            "reviews": 255,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNRUpYrsCzNyGftbrQKb1KpJnVlQr3u3dquJkTH=w152-h152-n-k-no",
            "type": [
              "Coffee shop",
              "Cafe",
              "Espresso bar"
            ]
          }
        ]
      },
      {
        "search_term": "Other locations for Stumptown",
        "local_results": [
          {
            "position": 1,
            "title": "Stumptown Coffee Roasters",
            "data_id": "0x89c25996d46ccfed:0x3034ad801dc5fcb3",
            "reviews_link": "https://serpapi.com/search.json?engine=google_maps_reviews&hl=en&place_id=0x89c25996d46ccfed%3A0x3034ad801dc5fcb3",
            "gps_coordinates": {
              "latitude": 40.7328275,
              "longitude": -73.9979664
            },
            "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c25996d46ccfed%3A0x3034ad801dc5fcb3%218m2%213d40.7328275%214d-73.9979664&engine=google_maps&google_domain=google.com&hl=en&type=place",
            "rating": 4.5,
            "reviews": 1041,
            "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNg2KVi1X1frTSf4YtPsv0U-rp1I-BlExfvWje3=w152-h152-n-k-no",
            "type": [
              "Coffee shop",
              "Cafe",
              "Tea store",
              "Coffee store"
            ]
          }
        ]
      }
    ]
  }
}

Check out the documentation for more details.

Disclaimer: I work at SerpApi.

Milos Djurdjevic
  • 364
  • 1
  • 11