Closed xauxatz closed 7 years ago
I think it should
In fact I verified the request in my debugger and it does not take "freshness" into account. What is worse, it doesn't take "skip" (offset) into account either... It is simply not build into the search string
I'm finding same things -- none of these are supported. Part of the problem with rewriting the api interface
cc: 'US',
freshness: 'Day',
setLang: 'EN'
Ok, I'll look into it this week
for now you can get around it by doing this:
bing.news(`javascript&freshness=Day&setLang=EN&cc=US`, {
top: this.count,
skip: this.skip
}, (err, res, body) => {
if (err) return reject(err);
resolve(body);
})
instead of mapping your custom option names to legit ones you should just take what we give you and turn them into key=value pairs in the query string. This is one liner with require('url').build(options)
any luck on this?
const querystring = require('querystring');
const qStr = querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' })
console.log(qStr); // returns 'foo=bar&baz=qux&baz=quux&corge='
https://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options
submitted a pr:
Ok, I have accepted the PR and also refactored the code. Sorry it took so long, my account key was not valid any more and microsoft was failing when requesting a new one. I have merged the changes. I publish the new version. Let me know if everything is cool.
Btw, I'm planning to update the code to ES6 for the v4. As a tiny survey... would you find any inconvenience with that?
i'm already using es7 with --harmony-async-await flag so that's fine with me. I would avoid using babel on the server side though.
I would only use ES6 features supported on the stable version (6.9.5)
You can close this issue to confirm your satisfaction with the solution. An start on the repo would be also nice. Stars make developers happy :star: :smile:
Thanks :-)
Hi - does node-bing-api support the freshness parameter?