Yet another node lib for requesting Duck Duck Go.
This one has been written in typescript (2.x or above) and can be used by javascript (es2018 or above) software or by typescript software.
async function get() {
try {
const result = await duckIt('bart simpsons');
console.log(result.data.AbstractText);
} catch (err) {
console.error('oups', err);
}
}
- duckIt uses axios and return an AxiosResponse:
const result = await duckIt('bart simpsons');
- duckIt can be called with an options object, eahc item is optional:
- appName: an application name, default node-duckduckgo
- format: received format data, possible values: 'json' or 'xml', default 'json'
- parentalFilter: parental filter activated or not, possible values 'Activated', 'Moderate' and 'Deactivated', default: 'Activated'
- noRedirect: boolean, true to skip HTTP redirects
- noHtml: boolean, true to remove HTML from text
- skipDisambig: boolean, true to skip disambiguation (for information about this options see Duck Duck GO API documentation
example:
const result = await duckIt('bart simpsons', { noHtml: true, parentalFilter: 'Moderate' });
node-duckduckgo (this lib) is open sources (MIT license) but to use Duck Duck Go results you need to follow Duck Duck Go's Terms and Conditions. Please read this page before any usage.
This major release offers a completly different interface than 1.x. You may continue to use 1.X but as it won't evolve anymore, your advise to migrate to 2.X.