HansMu158
HansMu158

Reputation: 555

Setting Language of API in NodeJS

I am trying to implement the DuckDuckGo Instant Answer Api into my NodeJS application. For that I request data from the Api using Node Request.

var request = require('request');
request('http://api.duckduckgo.com/?q=Hamburg&format=json&pretty=1', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(JSON.parse(body));
  }
})

This gives me the result in English, but I would like to have it in German. In my browser it is in German. How can I change my code so I can get the data in German in NodeJS?

Thank you!

Upvotes: 1

Views: 319

Answers (1)

joaumg
joaumg

Reputation: 1248

You can add the kad key with a proper locale.

As so:

http://api.duckduckgo.com/?q=Hamburg&format=json&pretty=1&kad=de_DE

Upvotes: 1

Related Questions