struct

DuckDuckGo::InstantAnswer

Inherits JSON::Serializable < Struct < Value < Object

The main response from the Instant Answer API

Constructors

new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

abstract

Topic summary (may contain HTML)

Source
abstract_source

Source of the abstract (e.g., "Wikipedia")

Source
abstract_text

Topic summary (plain text)

Source
abstract_url

URL to the abstract source

Source
answer

Instant answer text (can be string or object in API, normalized to string)

Source
answer_type

Answer type as enum

Source
answer_type_raw

Type of instant answer (raw string)

Source
article?

Check if this is an article

Source
category?

Check if this is a category

Source
definition

Dictionary definition

Source
definition_source

Source of definition

Source
definition_url

URL to definition source

Source
disambiguation?

Check if this is a disambiguation page

Source
entity

Additional fields that appear in some responses

Source
has_results?

Check if there are any results

Source
heading

Topic name/title

Source
image

Image URL associated with abstract

Source
image_height
Source
image_is_logo
Source
image_width
Source
infobox
Source
instant_answer?

Check if this has an instant answer

Source
redirect

Redirect URL for !bang commands

Source
redirect?

Check if this is a !bang redirect

Source
results

External results (rare)

Source
topic_groups

Get topic groups (for disambiguation pages)

Source
type

Response type as enum

Source
type_raw

Response type (raw string)

Source
zci

Get the best single text answer (zero-click info) Returns the most relevant text based on response type priority:

  1. Abstract text (articles)
  2. Answer (instant answers)
  3. Definition
  4. First related topic text
  5. Redirect URL (!bangs)
Source