Wikipedia search

Search English Wikipedia for matching pages.

  • Web
  • Since 0.2.0
  • addon
  • wikipedia
  • search
  • pages
  • text
  • web
  • data

Open in TuneToys

Wikipedia search as the Patch draws it, at default values: inlets on the left, outlets on the right.

Wikipedia search looks up pages on English Wikipedia by title and content. It needs no key.

What it does#

The node is generated from the wikipedia addon manifest. It requests GET https://en.wikipedia.org/w/rest.php/v1/search/page?q=…&limit=… and runs it like a Web request. response is JSON with a pages list; each page has id, key, title, excerpt, description and, when there is one, a thumbnail.

The search terms come from the q port when cabled, otherwise from the node's q field. With trigger cabled each trigger searches; otherwise a change on a cabled port does; with no cable at all it searches once at start.

A Toy using this node requires the network and the wikipedia addon, enabled in Settings → Addons. Text is CC BY-SA 4.0.

When to use it#

Use it to find articles, then feed a page's key to Wikipedia summary or step through the results with List.

Ports#

PortDirectionSignalLanes
triggerInputData (trigger)1
qInputData (string)1
limitInputData (integer)1
responseOutputData (json)1
statusOutputData (integer)1
errorOutputData (string)1
doneOutputData (trigger)1

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
limitLimit1 to 10010linearMost pages returned, 1 to 100. Used while the port has no cable.
  • q: text.

Limit (limit)#

The most pages returned, 1 to 100 (10 by default).

Query#

The q text field holds the search terms (up to 300 characters), used while the q port has no cable.

Tips#

  • excerpt contains HTML highlight markup; use title or description for plain text.
  • Pick the first title with Convert and path /pages/0/title.

See also#

Wikipedia summary, Convert, List, Data cables.

Help patches

Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.

1. Search for instruments

beginner Teaches: limit

Wikipedia search returns matching pages; Convert picks the first title.

Patch: Wikipedia search response output connected to Convert value input. Convert value output connected to Console log value input.
Connections as text
  • Wikipedia search response output connected to Convert value input
  • Convert value output connected to Console log value input
  • Limit caps the pages returned; each has id, key, title, excerpt and description.
Frame preview: Search for instrumentsFrame “Search for instruments” with 2 elements: text heading, text hint.SEARCH FOR INSTRUMENTSNeeds the network and the Wikipedia addon enabled. Text from Wikipedia, CC BY-S…
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Wikipedia summary Lead extract of an English Wikipedia article.
  • Convert Convert a value to another datatype, optionally picking a field or formatting a string; failures go to error.
  • List List operations on data values: get, push, insert, remove, slice, sort, unique, flatten, join, range, sum, minimum, maximum, mean, shuffle and more.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close