JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26902
  • Score
    100M100P100Q158358F
  • License ISC

A DuckDuckGo scraper for Node.js.

Package Exports

  • duck-duck-scrape

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (duck-duck-scrape) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

duck-duck-scrape

A DuckDuckGo scraper NPM module

Note: This isn't endorsed by DuckDuckGo in any way.

NPM

Installation

npm install --save duck-duck-scrape

Setup

const DuckDuckScrape = require("duck-duck-scrape");
const ddg = new DuckDuckScrape();

Safe Search

 1 = Safe
-1 = Moderate
-2 = Off

For non-search functions safe search is a boolean

Functions

  //Search 
  ddg.search(query<String>, safe<Integer>, locale<locale string>) // returns a Promise
  
  //Autocomplete
  ddg.query(query<String>) // returns a Promise
  
  //Image Search (unstable, not sure why)
  ddg.image(query<String>, safe<Boolean>, locale<locale string>) // returns a Promise
  
  //Video Search
  ddg.video(query<String>, safe<Boolean>, locale<locale string>) // returns a Promise
  
  //Amazon Search
  ddg.amazon(query<String>, safe<Boolean>) // returns a Promise
  
  //Twitter Search
  ddg.twitter(handle<String>) // returns a Promise

Example

ddg.autocomplete("how to convert to ").then((value) => { console.log(value[0].phrase); }); // "how to convert to pdf"

Attribution

Original code by Snazzah

Packaged by suushii