Xyand
Xyand

Reputation: 4488

How to access Google search right hand side data programmatically?

Is there a way to access data on the right hand side of Google results programmatically?

Are there similar services around? Specifically for location data

Access = No html scraping

Here is an example: enter image description here

Upvotes: 5

Views: 4088

Answers (3)

Patrick Tang
Patrick Tang

Reputation: 31

If you have a budget, you may consider serpapi.com, a Google Search API provider which performs real-time Google search and returns the result as JSON.

A sample search of the keyword "Coffee" via the API would return the full SERP parameters and metadatas of the search result. The partial "knowledge panel" metadatas for the sample search is returned as followed:

"knowledge_graph": {
    "title": "Coffee",
    "image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
    "description": "Coffee is a brewed drink prepared from roasted coffee beans, the seeds of berries from certain Coffea species. The genus Coffea is native to tropical Africa and Madagascar, the Comoros, Mauritius, and Réunion in the Indian Ocean.",
    "source": {
      "name": "Wikipedia",
      "link": "https://en.wikipedia.org/wiki/Coffee"
    },
    "countries_of_origin": "Yemen (drink), Ethiopia (plant)",
    "coffee_companies": [
      {
        "name": "Starbucks",
        "link": "https://www.google.com/search?hl=en&gl=us&q=Starbucks&stick=H4sIAAAAAAAAAONgFuLUz9U3MCorTMtVAjMNLZLji7REspOt9JPzc3Pz86xS8svzyhOLUopXMQoDxXJyUpNLMvPz9DOLi0tTi4oXsXIGlyQWJZUmZxcDANn7PURQAAAA&sa=X&ved=2ahUKEwjPi5uzxvDhAhXHu54KHXouArgQxA0wJnoECBIQBQ",
        "source": "common"....

Comparison between the search result and the JSON result

Upvotes: 1

Sherrypha
Sherrypha

Reputation: 11

You can use the google knowledge graph API for this

  • create an application in google developers console
  • create authentication credentials

     knowlegdegraph<-function(query)
    {
       API_Key<-"YOUR_API_KEY"
       url<-paste("https://kgsearch.googleapis.com/v1/entities:search?query=",query, 
         "&key=", API_Key,
         "&limit=1&indent=True")
      jdata <- fromJSON(URLencode(url))
    
    } 
    

    Jdata is a list. you can extract the JSON element for location from it

Upvotes: 1

JSuar
JSuar

Reputation: 21091

2018 Update - Knowledge Panels

When people search for a business on Google, they may see information about that business in a box that appears to the right of their search results. The information in the box, called the knowledge panel, can help customers discover and contact your business.

Knowledge Panel Example

Knowledge panels are powered by information in the Knowledge Graph.


Google's Knowledge Graph

The example in your question comes from Google's Knowledge Graph.

The Short Life of the Open Knowledge Graph provides a good explanation why Google's Knowledge Graph data is not publicly available and why the project is shutting down.

[Jack Menzel, a Product Management Director at Google,] explained that there was a couple of specific reasons why Google couldn’t “participate” in the Open Knowledge Graph project. First, some of the data in the Google Knowledge Graph are from closed datasets acquired from sources that did not granted Google the rights to redistribute them. Some other datasets have more open licenses, but still have share-alike or attribution constraints. Second, he reminded that – by principle – Google was blocking any kind of automatic extraction allowing to collect information about its search and ranking technologies because “they were the proprietary cores of what Google provides”.

Alternative Solutions

I tried to list in order of your preference for location data.

Upvotes: 5

Related Questions