
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
google-kgsearch
Advanced tools
google-kgsearch is a wrapper for Google's Knowledge Graph Search API. It is lightweight, simple, and easy to understand.
About Google's Knowledge Graph Search API:
The Knowledge Graph Search API lets you find entities in the Google Knowledge Graph. The API uses standard schema.org types and is compliant with the JSON-LD specification.
An excerpt from: https://developers.google.com/knowledge-graph/
Some examples of how you can use the Knowledge Graph Search API include:
Create a KGSearch instance with your API Key, store it in a variable (in this case: kGraph), and then call kGraph.search(params, callback)
import KGSearch from 'google-kgsearch'
const kGraph = KGSearch(process.env.KGSEARCH_API_KEY)
let params = {
query: 'Taylor Swift',
types: 'Person',
limit: 1
}
kGraph.search(params, (err, items) => {
if (err) console.error(err)
console.log(items)
})
Outputs an object:
[
{
'@type': 'EntitySearchResult',
result: {
'@id': 'kg:/m/0dl567',
name: 'Taylor Swift',
'@type': [object],
description: 'Singer-songwriter',
image: [object],
detailedDescription: [object],
url: 'http://www.taylorswift.com/'
},
resultScore: 280.279816
}
]
See the example for more information.
Installing google-kgsearch is as simple as installing any other npm module:
$ npm install google-kgsearch --save
To use this API you need an API key. An API key identifies your project to check quotas and access. Go to the Credentials page to get an API key.
Check out Google Developers' guide for more information.
After importing the google-kgsearch file, you need to initialize a new KGSearch instance with your API_TOKEN and store it in a variable (in this case its kGraph):
import KGSearch from 'google-kgsearch'
const kGraph = KGSearch(process.env.KGSEARCH_API_KEY)
Use the .search() method to search Google's Knowledge Graph.
/* ... */
kGraph.search({ query: 'Puerto Rico'}, (err, items) => {
if (err) console.error(err)
console.log(items)
})
The kGraph.search(params, callback) method takes params as a first argument. Under the hood the module converts these into query strings.
It also takes a callback function to handle the data received from the API.
KGSearch| Argument | Type | Description |
|---|---|---|
api_key (required) | string | Enables access to the Google's Knowledge Graph Search API |
.search()Method of KGSearch(api_key)
| Argument | Type | Description |
|---|---|---|
params (required) | object | API query parameters (query, types, limit, etc.) |
callback (required) | function | A function that handles the response data from the API |
callback takes two arguments:
err (for error handling; null if there are no errors)data (the data returned by the API)Something does not work as expected or perhaps you think this module needs a feature? Please open an issue using GitHub's issue tracker. Please be as specific and straightforward as possible.
Pull Requests (PRs) are welcome. Make sure you follow the same basic stylistic conventions as the original code (i.e. "JavaScript standard code style")
Copyright (c) 2016 Kristian Muñiz
FAQs
A simple wrapper for Google's Knowledge Graph Search API
We found that google-kgsearch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.