@hammerhead/duckduckgosearch
v1.0.2
Published
A DuckDuckGo search wrapper with text, images, videos, news, instant answers and related queries.
Readme
🦆🔍 @hammerhead/duckduckgosearch
A simple Node.js wrapper for DuckDuckGo that supports text, images, videos, news, instant answers, and related searches.
Built with fetch + cheerio. No official API key required.
✨ Features
- 📄 Text search with pagination
- 🖼️ Image search with pagination
- 🎬 Video search
- 📰 News search with pagination
- ⚡ Instant answers via DuckDuckGo's API
- 🔗 Related searches
📦 Installation
pnpm add @hammerhead/duckduckgosearch
# or
npm install @hammerhead/duckduckgosearchUsage
import DuckDuckGoSearch from "@hammerhead/duckduckgosearch";
const ddg = await DuckDuckGoSearch();
// 🔍 Text Search
const textResults = await ddg.text("nodejs", 2); // 2 pages
console.log(textResults);
// 🖼️ Image Search
const images = await ddg.images("cats", { page: 1, maxResults: 10 });
console.log(images);
// 🎬 Video Search
const videos = await ddg.videos("javascript tutorial", 5);
console.log(videos);
// 📰 News Search
const news = await ddg.news("AI technology", { page: 1, limit: 5 });
console.log(news);
// ⚡ Instant Answer
const instant = await ddg.instant("What is Node.js?");
console.log(instant);
// 🔗 Related Searches
const related = await ddg.related("open source");
console.log(related);