Node.js module for the Bing Search API (Cognitive Services)
Find a file
Mr. Goferito 12ebfcb92f Merge pull request #10 from jemartti/master
Making callbacks the last parameter + jsbeautifer
2015-05-23 19:50:31 +02:00
lib Adding jsbeautifier grunt task 2015-05-07 20:13:17 -04:00
test Adding jsbeautifier grunt task 2015-05-07 20:13:17 -04:00
.gitignore Add integration tests 2015-05-07 12:50:30 +02:00
Gruntfile.js Adding jsbeautifier grunt task 2015-05-07 20:13:17 -04:00
index.js Git init 2014-09-18 18:24:52 +02:00
LICENSE Add license file 2014-09-19 14:50:37 +02:00
package.json Adding jsbeautifier grunt task 2015-05-07 20:13:17 -04:00
README.md Making callbacks the last parameter (standard node practice) 2015-05-07 20:09:17 -04:00

Node Bing API

Node.js lib for the Azure Bing Web Search API

Installation

npm install node-bing-api

Usage

Require the library and initialialize it with your account key:

var Bing = require('node-bing-api')({ accKey: "your-account-key" });
Bing.web("Pizza", {
    top: 10,  // Number of results (max 50)
    skip: 3,   // Skip first 3 results
  }, function(error, res, body){
    console.log(body);
  });
Bing.composite("xbox", {
    top: 10,  // Number of results (max 50)
    skip: 3,   // Skip first 3 results
    sources: "web+news", //Choises are web+image+video+news+spell
    newssortby: "Date" //Choices are Date, Relevance
  }, function(error, res, body){
    console.log(body);
  });
Bing.news("xbox", {
    top: 10,  // Number of results (max 50)
    skip: 3,   // Skip first 3 results
    newssortby: "Date" //Choices are: Date, Relevance
    newscategory: "rt_Business" // Choices are:
                                //   rt_Business
                                //   rt_Entertainment
                                //   rt_Health
                                //   rt_Politics
                                //   rt_Sports
                                //   rt_US
                                //   rt_World
                                //   rt_ScienceAndTechnology
  }, function(error, res, body){
    console.log(body);
  });
Bing.video("monkey vs frog", {
    top: 10,  // Number of results (max 50)
    skip: 3,   // Skip first 3 result
    videofilters: {
      duration: 'short',
      resolution: 'high'
    }
  }, function(error, res, body){
    console.log(body);
  });
Bing.images("Ninja Turtles", {skip: 50}, function(error, res, body){
  console.log(body);
});

Adding filter(s) for the Image Search

Bing.images("Ninja Turtles", {
    imagefilters: {
      size: 'small',
      color: 'monochrome'
    }
  }, function(error, res, body){
  console.log(body);
  });

Accepted filter values:

  • Size:<Small | Medium | Large>
  • Size:Height:<Height>
  • Size:Width:<Width>
  • Aspect:<Square | Wide | Tall>
  • Color:<Color | Monochrome>
  • Style:<Photo | Graphics>
  • Face:<Face | Portrait | Other>

Specify Market

Getting spanish results:

Bing.images("Ninja Turtles", {top: 5, market: 'es-ES'}, function(error, res, body){
  console.log(body);
});

List of Bing Markets

Adult Filter

Bing.images('Kim Kardashian', {market: 'en-US', adult: 'Strict'}, function(error, res, body){
  console.log(body.d.results);
});

Accepted values: "Off", "Moderate", "Strict".

Moderate level should not include results with sexually explicit images or videos, but may include sexually explicit text.

License

MIT