WebSearch

WebSearch["string"]

gives a dataset of the top web search results for the specified literal string.

WebSearch[form]

gives the top results obtained by doing the web search specified by form.

WebSearch[form,elems]

gives the elements of the web search specified by elems.

Details and Options

  • WebSearch requires internet connectivity and uses external services that require Service Credits.
  • WebSearch supports the following basic search forms, which can be combined arbitrarily:
  • "string"complete string must occur in the page
    {s1,s2,}search for all si in the page
    s1|s2|at least one of the si must occur in the page
    SearchQueryString["query"]complete search enginestyle query
    "field"s1the si must occur in the given field
    FixedOrder[s1,s2,]the si must occur in the order given
    Except[q]q cannot occur in the page
  • Possible fields include:
  • "Country"search only within a given country's web domain
    "Site"search only within specified website
    "FileFormat"search only for files with the specified format
  • File formats can be specified either by strings as used by Import or by entities of type "FileFormat".
  • Possible options include:
  • AllowAdultContentFalsewhether to include adult-type results
    LanguageNonegive only pages in the specified language
    MaxItems10number of results to return
    MethodAutomaticexternal search service to use
  • Languages can be specified using entities of type "Language" or strings corresponding to standard names of languages.
  • Possible settings for Method include "Google" and "Bing".
  • Possible elements that can be specified by elems include:
  • "PageTitles"page titles
    "Snippets"textual snippets of page content
    "Hyperlinks"page hyperlinks

Examples

open allclose all

Basic Examples  (3)

Perform a basic web search:

In[1]:=
Click for copyable input
Out[1]=

Search using alternatives:

In[1]:=
Click for copyable input
Out[1]=

Search for pages containing all specified terms:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Options  (3)

See Also

WebImageSearch  WikipediaData  WikipediaSearch  TextSearch  ServiceExecute  $ServiceCreditsAvailable

Introduced in 2017
(11.1)