Bing news search API returns poor results comapred to Bing.com

Gidon Levakov 0 Reputation points
2023-07-04T12:01:12.4733333+00:00

Bing news search API returns results that seem to have low relevance to my search query. This is in contrast to the results I see when searching in "https://www.bing.com/news/search".

Code example:

from news_search_client import NewsSearchClient 
client = NewsSearchClient(endpoint = "https://api.bing.microsoft.com/v7.0/news", 
                            credential = AzureKeyCredential(os.environ["BING_NEWS_API_KEY"]))
search_term = "top importers of TEU from Vietnam to US"
news_result = client.news.search(query=search_term)

extracted_results = []
for result in news_result.value:
    result_dict = {'title': result.name, 'url': result.url, 'description': result.description,
                'published': result.date_published[:16]}
    extracted_results.append(result_dict)

print(extracted_results)

Results:

[
    {
        "title": "The 200 Year Pound to Dollar Exchange Rate History - From $5 in 1800s to Today's $1.29",
        "url": "https://www.exchangerates.org.uk/articles/1325/the-200-year-pound-to-dollar-exchange-rate-history-from-5-in-1800s-to-todays.html",
        "description": "In the US, post-Vietnam war pressure on the US Dollar saw President Nixon devalue the US Dollar, pegging the Greenback at $38 an ounce as opposed to the $35 per ounce throughout the Bretton Woods ...",
        "published": "2023-07-03T00:00",
    },
    {
        "title": "How to Call United States From Vietnam",
        "url": "https://www.prokerala.com/how-to/call/united-states-of-america?from=viet-nam",
        "description": "To make a direct call to United States From Vietnam, you need to follow the international dialing format given below. The dialing format is same for calling United States mobile or land line from Vietnam. To call United States from Vietnam, dial ...",
        "published": "2023-07-03T00:00",
    },
    {
        "title": "United States",
        "url": "https://www.reuters.com/world/us/",
        "description": "Worldcategory CIA director called Kremlin to assure US had no role in aborted mutiny, US media reports CIA Director William Burns called Russian spy chief Sergei Naryshkin after last week's ...",
        "published": "2023-07-02T00:00",
    },
    {
        "title": "Binance.US prepares to suspend US dollar deposits and withdrawals from exchange",
        "url": "https://www.theguardian.com/business/2023/jun/09/binanceus-prepares-to-suspend-us-dollar-deposits-and-withdrawals-from-exchange",
        "description": "Company tells customers to withdraw their US dollars days after US regulators sued the company and its founder The crypto company Binance.US will suspend US dollar deposits as its banking partners ...",
        "published": "2023-06-09T15:20",
    },
    {
        "title": "How to watch The Last of Us online from anywhere, stream all nine episodes of season one",
        "url": "https://www.techradar.com/how-to/how-to-watch-the-last-of-us-online-from-anywhere-2023",
        "description": "Although there's no shortage of snarling, otherworldly creatures and sweeping shots of landmarks turned graveyards, The Last of Us TV show is, at its core, a deeply affecting tale about empathy ...",
        "published": "2023-06-14T14:06",
    },
]

Notice only 2 of the 5 results contain the word Vietnam in the headline or the description, and none of them discusses trading.

Bing.com/news results:

User's image

Here all results contain the word Vietnam in the headline, and 4 of 5 discuss trading.

I tried several different endpoints:
'https://api.bing.microsoft.com/v7.0/news', 'https://api.bing.microsoft.com/v7.0/news/search', 'https://api.cognitive.microsoft.com/bing/v7.0/news'
All these resulted in the same news articles. I also tried different search queries and again poor results were returned using the API call, and good results from Bing.com/news.

What am I doing wrong?

Bing News Search
Bing News Search
A Bing service that supports searching for news and get comprehensive results.
50 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.