In the era of AI, quality information is the key to success. If you need informative and structured information about entities such as people, movies, places, and things. Knowledge graph results from Google or Bing will be your friend.


Bing Knowledge Graph provides details about entities, allowing you to scrape rich information, more insight into topics. You can use it to enrich your content.

In this tutorial, I'll guide you to scrape Bing Knowledge Graph without any effort

Setting up a SerpApi account

SerpApi offers a free plan for newly created accounts. Head to the sign-up page to register an account and complete your first search with our interactive playground. When you want to do more searches with us, please visit the pricing page.

Once you are familiar with all results, you can utilize SERP APIs using your API Key.

Scrape your first Bing Knowledge graph results with SerpApi

Head to the Bing Knowledge Graph Results from the documentation on SerpApi for details.

In this tutorial, we will scrape all books of "J.K. Rowling" using Bing Knowledge Graph results. The data contains: "title", "link", "thumbnail", "year". You can also scrape more information with SerpApi.

First, you need to install the SerpApi client library.

pip install google-search-results

Set up the SerpApi credentials and search.

import serpapi, os, json

params = {
    'api_key': 'YOUR_API_KEY',         # your serpapi api
    'engine': 'bing',                  # SerpApi search engine	
    'q': 'J.K. Rowling'
}

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


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

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

import csv

header = ['title', 'link', 'thumbnail', 'year']

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

    writer.writerow(header)

    for item in results:
        print(item)
        writer.writerow([item.get('title'), item.get('link'), item.get('thumbnail'), item.get('extension')])

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.