I am getting this response currently for searching for john smith
:
[
{
id: 'https://api.bing.microsoft.com/api/v7/#Entities.0',
contractualRules: [ [Object], [Object], [Object] ],
webSearchUrl: 'https://www.bing.com/entityexplore?q=John+Smith&filters=sid:%2266243836-10c8-c5b3-5d7b-c0b10ba5d0e2%22&elv=AXXfrEiqqD9r3GuelwApulo52kRgomTQ!IxyFb2qUdQjQ062Hv51bpReXtdKSYYKFtSPuQWQPVXUXq82omMLnXgCCLObIzUuycJIEZDUlJ59',
name: 'John Smith',
image: {
name: 'John Smith',
thumbnailUrl: 'https://www.bing.com/th?id=AMMS_323604fd0a40db79888011f68e12f643&w=110&h=110&c=12&rs=1&qlt=80&cdv=1&pid=16.2',
provider: [Array],
hostPageUrl: 'http://upload.wikimedia.org/wikipedia/commons/9/95/John_Smith_1957.jpg',
width: 110,
height: 110,
sourceWidth: 474,
sourceHeight: 610
},
description: 'John Smith was an American actor remembered in particular for his leading roles in two NBC western television series, Cimarron City and Laramie.',
entityPresentationInfo: {
entityScenario: 'DominantEntity',
entityTypeHints: [Array],
entityTypeDisplayHint: 'American Actor'
},
bingId: '66243836-10c8-c5b3-5d7b-c0b10ba5d0e2'
},
{
id: 'https://api.bing.microsoft.com/api/v7/#Entities.1',
contractualRules: [ [Object], [Object], [Object] ],
webSearchUrl: 'https://www.bing.com/entityexplore?q=John+Smith&filters=sid:%220753ace5-7704-daf0-650f-85e6de72168c%22&elv=AXXfrEiqqD9r3GuelwApulo52kRgomTQ!IxyFb2qUdQjQ062Hv51bpReXtdKSYYKFtSPuQWQPVXUXq82omMLnXgCCLObIzUuycJIEZDUlJ59',
name: 'John Smith',
image: {
name: 'John Smith',
thumbnailUrl: 'https://www.bing.com/th?id=AMMS_f40ffe0ae59a3c9788da0cacac680b56&w=110&h=110&c=12&rs=1&qlt=80&cdv=1&pid=16.2',
provider: [Array],
hostPageUrl: 'http://upload.wikimedia.org/wikipedia/commons/4/42/Captain_John_Smith_gravure_new.jpg',
width: 110,
height: 110,
sourceWidth: 474,
sourceHeight: 533
},
description: 'John Smith was an English soldier, explorer, colonial governor, Admiral of New England, and author. He played an important role in the establishment of the colony at Jamestown, Virginia, the first permanent English settlement in America, in the early 17th century. He was a leader of the Virginia Colony between September 1608 and August 1609, and he led an exploration along the rivers of Virginia and the Chesapeake Bay, during which he became the first English explorer to map the Chesapeake Bay area. Later, he explored and mapped the coast of New England. He was knighted for his services to Sigismund Báthory, Prince of Transylvania, and his friend Mózes Székely.',
entityPresentationInfo: { entityScenario: 'DominantEntity', entityTypeHints: [Array] },
bingId: '0753ace5-7704-daf0-650f-85e6de72168c'
}
]
Here is my code:
const fetch = require('node-fetch')
const endpoint = 'https://api.bing.microsoft.com'
const subscriptionKey = key1;
const host = 'api.bing.microsoft.com';
const path = '/v7.0/entities';
const searchApi = `https://api.bing.microsoft.com/v7.0/search`
const mkt = 'en-US';
const q = 'john smith';
start()
async function start() {
const query = '?mkt=' + mkt + '&q=' + encodeURI(q) + '&responseFilter=Entities,Webpages';
// const url = `https://${host}${path}${query}`
const url = `${searchApi}${query}`
const res = await fetch(url, {
headers: {
'Ocp-Apim-Subscription-Key' : subscriptionKey,
}
})
const result = await res.json()
if (result.error) {
console.log(result.error)
} else {
const array = result?.entities?.value ?? []
if (array.length) {
console.log(array)
}
}
}
Why is it only returning these generic responses. I thought it was going to give me more detailed things like LinkedIn profiles or other user related things. How do I get more user related content / social media profiles instead of this?
Searching in the browser I get better results, why am I not getting that?
Am I even using the right API, or should I be using https://api.cognitive.microsoft.com/bing/v7.0/...
or something like that? Actually it looks like they recently transitioned away from the cognitive services api.