# Wikipedia

> Search Wikipedia, read article summaries and full page content, and pull a random article.

App · Misc References · 4 actions. Web page: https://docs.lodol.com/docs/integrations/wikipedia

## Actions

### Get page content

Get the full plain-text content of a Wikipedia article by its title. Optionally return only the lead section.

**Inputs**

- Article title (`title`, text, required): The title of the Wikipedia article to read. Redirects are followed automatically.
- Intro only (`intro_only`, true/false): Return only the article's lead section instead of the full text. Defaults to false. Default: `false`.
- Language (`language`, text): Wikipedia language edition to read, as a language code, for example 'en' (English), 'es' (Spanish), 'de' (German), or 'simple' (Simple English). Defaults to English. Default: `en`.

**Outputs**

- `content` (text): Plain-text content of the article.
- `language` (text)
- `pageid` (number)
- `title` (text)
- `url` (text)

**Example output**

```json
{
  "content": "Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.\n\nPython is dynamically type-checked and garbage-collected.",
  "language": "en",
  "pageid": 23862,
  "title": "Python (programming language)",
  "url": "https://en.wikipedia.org/wiki/Python_(programming_language)"
}
```

### Get random page

Get the summary of a random Wikipedia article, useful for discovery, prompts, or daily-fact style workflows.

**Inputs**

- Language (`language`, text): Wikipedia language edition to read, as a language code, for example 'en' (English), 'es' (Spanish), 'de' (German), or 'simple' (Simple English). Defaults to English. Default: `en`.

**Outputs**

- `description` (text)
- `extract` (text)
- `language` (text)
- `pageid` (number)
- `thumbnail` (text)
- `title` (text)
- `url` (text)

**Example output**

```json
{
  "description": "Scenic road in Virginia and North Carolina, United States",
  "extract": "The Blue Ridge Parkway is a National Parkway and All-American Road in the United States, noted for its scenic beauty. The parkway runs for 469 miles through 29 Virginia and North Carolina counties.",
  "language": "en",
  "pageid": 320321,
  "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2e/Blue_Ridge_Parkway.jpg/320px-Blue_Ridge_Parkway.jpg",
  "title": "Blue Ridge Parkway",
  "url": "https://en.wikipedia.org/wiki/Blue_Ridge_Parkway"
}
```

### Get summary

Get the short summary (lead extract) of a Wikipedia article by its title, along with its description, thumbnail, and link.

**Inputs**

- Article title (`title`, text, required): The exact title of the Wikipedia article, for example 'Python (programming language)'.
- Language (`language`, text): Wikipedia language edition to read, as a language code, for example 'en' (English), 'es' (Spanish), 'de' (German), or 'simple' (Simple English). Defaults to English. Default: `en`.

**Outputs**

- `description` (text)
- `extract` (text): Plain-text lead summary of the article.
- `language` (text)
- `pageid` (number)
- `thumbnail` (text): URL of the article's thumbnail image, if any.
- `title` (text)
- `url` (text): Canonical URL of the article.

**Example output**

```json
{
  "description": "General-purpose programming language",
  "extract": "Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.",
  "language": "en",
  "pageid": 23862,
  "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/320px-Python-logo-notext.svg.png",
  "title": "Python (programming language)",
  "url": "https://en.wikipedia.org/wiki/Python_(programming_language)"
}
```

### Search

Search Wikipedia for articles matching a query and return the matching titles with short snippets and links.

**Inputs**

- Search query (`query`, text, required): What to search Wikipedia for, for example 'quantum computing'.
- Result limit (`limit`, number): Maximum number of results to return (1–50). Defaults to 10. From 1 to 50. Default: `10`.
- Language (`language`, text): Wikipedia language edition to read, as a language code, for example 'en' (English), 'es' (Spanish), 'de' (German), or 'simple' (Simple English). Defaults to English. Default: `en`.

**Outputs**

- `count` (number): Number of results returned.
- `language` (text)
- `query` (text)
- `results` (list)
- `total_hits` (number): Total number of matching articles on Wikipedia.

**Example output**

```json
{
  "count": 2,
  "language": "en",
  "query": "python programming",
  "results": [
    {
      "pageid": 23862,
      "size": 178234,
      "snippet": "Python is a high-level, general-purpose programming language.",
      "timestamp": "2024-01-15T09:12:00Z",
      "title": "Python (programming language)",
      "url": "https://en.wikipedia.org/wiki/Python_(programming_language)",
      "wordcount": 12043
    },
    {
      "pageid": 21356332,
      "size": 41234,
      "snippet": "The programming language Python was conceived in the late 1980s.",
      "timestamp": "2024-01-10T14:00:00Z",
      "title": "History of Python",
      "url": "https://en.wikipedia.org/wiki/History_of_Python",
      "wordcount": 3120
    }
  ],
  "total_hits": 4213
}
```
