> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Scrape Google Knowledge Graph Results
- URL: https://serpapi.com/blog/how-to-scrape-google-knowledge-graph-results/
- Published: 2023-12-10T14:07:29.000Z
- Updated: 2023-12-10T14:07:29.000Z
- Author: Andy L

Google is the most famous search engine. Google offers Google knowledge graph results for some keywords. Google gathers information from various sources to create a structured and comprehensive representation of facts about people, places, companies and things.

![](https://lh7-us.googleusercontent.com/5vsBBR2YTZWWAU0KaRR5k2i8xqRBSIG1uvYZ-JlKMX2XnX0IjO8iqEziqUTR-uBxcaQTZ6r3rl-TEkhD5V3uuMNDzvn2R1pHpkOW0U1UuYVRvre5C5F4cU6YxiYqTEW-NlrF8RKbVjiHHTUgetBWIo8)

Google Knowledge Graph is one of the good quality sources to enhance your search results, providing more detailed and contextually relevant information directly on the search results page.

By scraping the Google Knowledge graph, you can give a quick answer, get all linking information, help your AI semantic understanding of language and user queries, leading to more accurate search results.

![](https://lh7-us.googleusercontent.com/O0NE0rtBAAn8PASa3V7vU5iKJfsjeslbw0UwyyOXcAL9nvPPE3CUDErzg_R-ReqZPygD0weLe_hKs6ndWrmfvgfRhp6fc8oagf21BrnQdYSVm9LCYRBr9TFXUPH1sn3CQrIt4sNpTx_NcYjc5Hw8l0o)

In my previous blog post, I showed you how to scrape [Bing Knowledge Graph](https://serpapi.com/blog/how-to-scrape-bing-knowledge-graph-results/) in minutes. It would be easy to scrape Google Knowledge Graph with SerpApi. 

### Setting up a SerpApi account

[SerpApi](https://serpapi.com/) offers a free plan for newly created accounts. Head to the [sign-up](https://serpapi.com/users/sign%5Fup?plan=free) page to register an account and complete your first search with our [interactive playground](https://serpapi.com/playground?engine=google). When you want to do more searches with us, please visit the [pricing page](https://serpapi.com/pricing).

Once you are familiar with all results, you can utilize SERP APIs using your [API Key](https://serpapi.com/manage-api-key).

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2023/12/Screenshot-2023-12-07-at-21.00.35.png)

### Scrape your first Google Knowledge graph results with SerpApi

Head to the Google Knowledge Graph Results from the [documentation](https://serpapi.com/knowledge-graph) on [SerpApi](https://serpapi.com/) for details.

In this tutorial, we will scrape all listening sources of "Taylor Swift" using Google Knowledge Graph results. The data contains: "name", "link", "image". You can also scrape more information with [SerpApi](https://serpapi.com/).

First, you need to install the [SerpApi client library](https://github.com/serpapi/serpapi-python).

```python
pip install google-search-results
```

Set up the[ SerpApi](https://serpapi.com/?ref=serpapi.com)[ credentials](https://serpapi.com/manage-api-key?ref=serpapi.com) and search.

```python
import serpapi, os, json

params = {
    'api_key': 'YOUR_API_KEY',         # your serpapi api
    'engine': 'google',                # SerpApi search engine	
    'q': 'Taylor Swift'
}

```

To retrieve Google Knowledge Graph Results for a given search term, you can use the following code:

```python

results = serpapi.Client().search(params).get_dict()['knowledge_graph']['listen']
```

You can store Google Knowledge Graph Results JSON data in databases or export them to a CSV file.

```python
import csv

header = ['name', 'link', 'image']

with open('listen.csv', 'w', encoding='UTF8', newline='') as f:
    writer = csv.writer(f)

    writer.writerow(header)

    for item in results:
        print(item)
        writer.writerow([item.get('name'), item.get('link'), item.get('image')])

```

This example is using Python, but you can also use your all your favorite programming languages likes Ruby, NodeJS, Java, PHP....

If you have any questions, please feel free to [contact me](mailto:andy@serpapi.com).