Devansh Chauhan
Devansh Chauhan

Reputation: 21

originalImg parameter not working in Bing News Search APIs

Bing news search API not providing image in original thumbnail size in News Category.

const url = 'https://bing-news-search1.p.rapidapi.com/news?&originalImg=true&category=india&cc=in&safeSearch=Off&textFormat=Raw';
const options = {
method: 'GET',
headers: {
    'X-BingApis-SDK': 'true',
    'X-RapidAPI-Key': 'f6eaf58061msh81443620cb46a37p127041jsnac_xxxxxxxx',
    'X-RapidAPI-Host': 'bing-news-search1.p.rapidapi.com'
    }
};

output is like:

{
url:"https://www.msn.com/en-in/news/world/sc-refuses-to-entertain-pil-for-inauguration-of-new-parliament-building-by-president/ar-AA1bJGRr"
image: {
_type:"ImageObject"
thumbnail:
_type:"ImageObject"
contentUrl:"https://www.bing.com/th?id=OVFT._MJPdPJ958_nyj_Ker8qOy&pid=News"
width:1280
height:720
isLicensed:true
}
}

This URL image Is 100*100 there is no any original image URL.

I am expecting output like this:

image: {
_type:"ImageObject"
contentUrl:"https://s.yimg.com/ny/api/res/1.2/6vOM5nkYbwetaWehEa6lGg--/YXBwaWQ9aGlnaGxhbmRlcjt3PTEyMDA7aD02MDA-/https://media.zenfs.com/en/hearst_womens_health_52/9743c154e3be883ec18c41f03fc44d58"
thumbnail:
_type:"ImageObject"
contentUrl:"https://www.bing.com/th?id=OVFT.1Wypj4IiKxycYuiB2Q81GC&pid=News"
width:700
height:350
}

Upvotes: 0

Views: 152

Answers (1)

Igal Nassima
Igal Nassima

Reputation: 11

In case if anyone else is looking for a solution, Base on the Bing New Search API v7 Documentation,

originalImg parameter is only used when using the "/news/search" endpoint

"Use this parameter only with the News Search API. Do not specify this parameter when calling the Web Search API. Trending Topics ignores this parameter."

https://learn.microsoft.com/en-us/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#query-parameters

Upvotes: 0

Related Questions