title | titleSuffix | description | services | author | manager | ms.service | ms.subservice | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|
Bing Video Search JavaScript client library quickstart |
Bing Search Services |
The Video Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this JavaScript quickstart to send search requests and get back results. |
bing-search-services |
swhite-msft |
ehansen |
bing-search-services |
bing-video-search |
quickstart |
07/15/2020 |
scottwhi |
Use this quickstart to begin searching for news with the Bing Video Search client library for JavaScript. While Bing Video Search has a REST API compatible with most programming languages, the client library provides an easy way to integrate the service into your applications. The source code for this sample can be found on GitHub. It contains more annotations and features.
To set up a console application using the Bing Video Search client library:
- Run
npm install ms-rest-azure
in your development environment. - Run
npm install azure-cognitiveservices-videosearch
in your development environment.
-
Create a new JavaScript file in your favorite IDE or editor, and add a
require()
statement for the Bing Video Search client library, andCognitiveServicesCredentials
module. Create a variable for your subscription key.const CognitiveServicesCredentials = require('ms-rest-azure').CognitiveServicesCredentials; const VideoSearchAPIClient = require('azure-cognitiveservices-videosearch');
-
Create an instance of
CognitiveServicesCredentials
with your key. Then use it to create an instance of the video search client.let credentials = new CognitiveServicesCredentials('YOUR-ACCESS-KEY'); let client = new VideoSearchAPIClient(credentials);
-
Use
client.videosOperations.search()
to send a search request to the Bing Video Search API. When the search results are returned, use.then()
to log the result.client.videosOperations.search('Interstellar Trailer').then((result) => { console.log(result.value); }).catch((err) => { throw err; });
[!div class="nextstepaction"] Create a single page web app.