Added bing Composite Search support

This commit is contained in:
Lennard Westerveld 2015-03-24 15:33:31 +01:00
parent 1aa77581a4
commit 352f36d7c9
2 changed files with 33 additions and 1 deletions

View file

@ -19,6 +19,17 @@ var Bing = require('node-bing-api')({ accKey: "your-account-key" });
Bing.web("Pizza", function(error, res, body){
console.log(body);
},
{
top: 10, // Number of results (max 50)
skip: 3, // Skip first 3 results
});
```
#### Composite Search:
```js
Bing.composite("xbox", function(error, res, body){
console.log(body);
},
{
top: 10, // Number of results (max 50)
skip: 3, // Skip first 3 results

View file

@ -22,7 +22,7 @@ var Bing = function( options ) {
var defaults = {
//Bing Search API URI
rootUri: "https://api.datamarket.azure.com/Bing/Search/",
rootUri: "https://api.datamarket.azure.com/Bing/Search/v1/",
//Account Key
accKey: null,
@ -131,6 +131,27 @@ Bing.prototype.web = function(query, callback, options) {
Bing.prototype.search = Bing.prototype.web;
/**
* Performs a Bing search in the Composite vertical.
*
* @param {String} query Query term to search for.
*
* @param {requestCallback} callback Callback called with (potentially
* json-parsed) response.
*
* @param {Object} options Options to command, allows overriding
* of rootUri, accKey (Bing API key),
* userAgent, reqTimeout, top, skip,
* @function
*/
Bing.prototype.composite = function(query, callback, options) {
this.searchVertical(query, "Composite", callback, options);
};
// Alias Bing.search to Bing.web
// Note: Keep this for compatibility with older versions
Bing.prototype.search = Bing.prototype.composite;
/**
* Performs a Bing search in the Images vertical.
*