Making callbacks the last parameter (standard node practice)
This commit is contained in:
parent
1b926b75c7
commit
82cd4e5118
3 changed files with 88 additions and 97 deletions
52
README.md
52
README.md
|
@ -16,34 +16,29 @@ var Bing = require('node-bing-api')({ accKey: "your-account-key" });
|
|||
|
||||
#### Web Search:
|
||||
```js
|
||||
Bing.web("Pizza", function(error, res, body){
|
||||
console.log(body);
|
||||
},
|
||||
{
|
||||
Bing.web("Pizza", {
|
||||
top: 10, // Number of results (max 50)
|
||||
skip: 3, // Skip first 3 results
|
||||
}, function(error, res, body){
|
||||
console.log(body);
|
||||
});
|
||||
```
|
||||
|
||||
#### Composite Search:
|
||||
```js
|
||||
Bing.composite("xbox", 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);
|
||||
});
|
||||
```
|
||||
|
||||
#### News Search:
|
||||
```js
|
||||
Bing.news("xbox", 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
|
||||
|
@ -56,40 +51,40 @@ Bing.news("xbox", function(error, res, body){
|
|||
// rt_US
|
||||
// rt_World
|
||||
// rt_ScienceAndTechnology
|
||||
}, function(error, res, body){
|
||||
console.log(body);
|
||||
});
|
||||
```
|
||||
|
||||
#### Video Search:
|
||||
```js
|
||||
Bing.video("monkey vs frog", 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'
|
||||
resolution: 'high'
|
||||
}
|
||||
}, function(error, res, body){
|
||||
console.log(body);
|
||||
});
|
||||
```
|
||||
|
||||
#### Images Search:
|
||||
```js
|
||||
Bing.images("Ninja Turtles", function(error, res, body){
|
||||
Bing.images("Ninja Turtles", {skip: 50}, function(error, res, body){
|
||||
console.log(body);
|
||||
}, {skip: 50});
|
||||
});
|
||||
```
|
||||
Adding filter(s) for the Image Search
|
||||
```js
|
||||
Bing.images("Ninja Turtles", function(error, res, body){
|
||||
console.log(body);
|
||||
},
|
||||
{
|
||||
Bing.images("Ninja Turtles", {
|
||||
imagefilters: {
|
||||
size: 'small',
|
||||
color: 'monochrome'
|
||||
color: 'monochrome'
|
||||
}
|
||||
}, function(error, res, body){
|
||||
console.log(body);
|
||||
});
|
||||
```
|
||||
Accepted filter values:
|
||||
|
@ -105,18 +100,18 @@ Accepted filter values:
|
|||
#### Specify Market
|
||||
Getting spanish results:
|
||||
```js
|
||||
Bing.images("Ninja Turtles", function(error, res, body){
|
||||
Bing.images("Ninja Turtles", {top: 5, market: 'es-ES'}, function(error, res, body){
|
||||
console.log(body);
|
||||
}, {top: 5, market: 'es-ES'});
|
||||
});
|
||||
```
|
||||
[List of Bing Markets](https://msdn.microsoft.com/en-us/library/dd251064.aspx)
|
||||
|
||||
|
||||
#### Adult Filter
|
||||
```js
|
||||
Bing.images('Kim Kardashian', function(error, res, body){
|
||||
Bing.images('Kim Kardashian', {market: 'en-US', adult: 'Strict'}, function(error, res, body){
|
||||
console.log(body.d.results);
|
||||
}, { market: 'en-US', adult: 'Strict'});
|
||||
});
|
||||
```
|
||||
Accepted values: "Off", "Moderate", "Strict".
|
||||
|
||||
|
@ -126,4 +121,3 @@ or videos, but may include sexually explicit text.*
|
|||
|
||||
## License
|
||||
MIT
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue