From 1aa77581a4af55d45e9a04dc06a72b8bcd4c0f10 Mon Sep 17 00:00:00 2001 From: Lennard Westerveld Date: Tue, 24 Mar 2015 15:23:14 +0100 Subject: [PATCH] Added settings for source type --- README.md | 4 +++- lib/bing.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd3cc38..a86754e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ Bing.web("Pizza", function(error, res, body){ }, { top: 10, // Number of results (max 50) - skip: 3 // Skip first 3 results + skip: 3, // Skip first 3 results + sources: "web+news", //Choises are web+image+video+news+spell + newssortby: "Date" //Choices are Date, Relevance }); ``` diff --git a/lib/bing.js b/lib/bing.js index d543c4f..12b3248 100644 --- a/lib/bing.js +++ b/lib/bing.js @@ -62,6 +62,8 @@ var Bing = function( options ) { + qs.stringify({ "Query": "'" + query + "'" }) + "&$top=" + opts.top + "&$skip=" + opts.skip + + (opts.sources ? "&Sources=%27" + opts.sources + "%27" : '') + + (opts.newssortby ? "&NewsSortBy=%27" + opts.newssortby + "%27" : '') + (opts.market ? "&Market=%27" + opts.market + "%27" : '') + (opts.adult ? "&Adult=%27" + opts.adult + "%27" : '') + (opts.imagefilters