Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ddg-api

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddg-api

A library for the DuckDuckGo APIs

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

DuckDuckGo Wrapper for Node.js

A very simple wrapper for the DuckDuckGo API (http://duckduckgo.com/api.html). Just simplifies an edge case error check and presents a simple way to set & reuse options.

Usage:

var ddg = require('ddg-api');
var client = new ddg.SearchClient({useSSL: true});
client.search("Apple Inc.", function(error, response, data) {

  if (!error && response.statusCode == 200)
  {
    console.log(data.Abstract);
  } else {
    console.log("ERROR! " + error + "/" + response.statusCode);
  }

});

Supported options:

/*
 * output format (json or XML - defaults to json)
 * Required
 */
format: "json"

/*
 * pretty print json output
 */
, prettyJson: false

/*
 * use SSL
 * defaults to false
 */
, useSSL: false

/*
 * Set strict SSL mode
 */
, strictSSL: false

/*
 * Base URL for API, includes the question mark
 */
, baseUrl: "http://api.duckduckgo.com/?"

/*
 * SSL Base URL for API, includes the question mark
 */
, sslBaseUrl: "https://api.duckduckgo.com/?"

/*
 * Skip redirect for bang commands (defaults to true because 
 * it doesn't make sense for an API client like this to redirect - 
 * not really sure it should be an option)
 */
, noRedirect: true

/*
 * Remove HTML from text
 * defaults to false
 */
, noHtml: false

/*
 * Skip Disambiguation records in the response
 * Defaults to false
 */
, skipDisambig: false

/*
 * User Agent
 *
 */
, userAgent: "DDG Search Client for Node.js ("+SearchClient.version+")"

License

Provided under the The MIT License (MIT) Copyright (c) 2011 Sujal Shah

See LICENSE for details

FAQs

Package last updated on 04 Nov 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc