seachapi
v1.0.1
Published
A Node.js wrapper for the duckduckgo-search Python library
Maintainers
Readme
DuckDuckGo Search API Wrapper
A lightweight Node.js wrapper for the duckduckgo-search Python library.
Prerequisites
This package requires Python 3 to be installed on your system.
It also relies on the duckduckgo-search Python package.
You can install the Python dependency via pip:
pip3 install duckduckgo-searchInstallation
npm install seachapiUsage
const { search } = require('seachapi');
// Simple search
search('javascript tutorials').then(results => {
console.log(results);
});
// Advanced search with options
search('python', {
max_results: 5,
region: 'us-en', // 'wt-wt', 'us-en', 'uk-en', etc.
safesearch: 'off', // 'on', 'moderate', 'off'
timelimit: 'w', // 'd' (day), 'w' (week), 'm' (month), 'y' (year)
type: 'text' // 'text', 'images', 'videos', 'news'
}).then(results => {
console.log(results);
});API
search(query, options)
query(string): The search term.options(object):max_results(number): Maximum results to return (default: 10).type(string): Search type:'text','images','videos','news'(default:'text').region(string): Region code (default:'wt-wt').safesearch(string): Safe search level (default:'moderate').timelimit(string): Time limit for results (default:null).user_agent(string): Custom User-Agent header (default:null).pythonPath(string): Path to python executable (default:'python3'or local venv).
License
MIT
