# Wikipedia Article Lookup by URL or Keyword (`vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword`) Actor

Fetch structured data for Wikipedia articles by URL or keyword search, in any language edition - summary, description, categories, images, and last-edit timestamp.

- **URL**: https://apify.com/vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword.md
- **Developed by:** [vexaloom-labs](https://apify.com/vexaloom-labs) (community)
- **Categories:** Automation, Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Wikipedia Article Lookup by URL or Keyword

Wikipedia exposes far more than an article's opening paragraph: a one-line description, the categories it belongs to, its images, its place on the map, the Wikidata entity behind it, its edit history, and the language editions it exists in. This actor collects that structure for articles you name by URL, exact title or keyword search — or for every page inside a Wikipedia category — and can add the full plain-text body, section outline, links, citation count, and pageview history.

Everything comes from Wikimedia's public APIs. There is no login, token, cookie or proxy setup.

### Ways to feed it

- **Paste URLs** — desktop, mobile and `index.php` links all work, in any language edition. A URL's own domain decides its language.
- **Name exact titles** — one title per list item, in the language edition you choose. Redirects are followed.
- **Search by keyword** — Wikipedia's ranked full-text search, with the result snippet and rank attached to each record.
- **Browse a category** — every page in a category (or several) becomes an article lookup.
- Mix any of the above in one run. An article reached through several URLs, titles or searches is emitted once, with those inputs recorded as provenance.

### What each record contains

| Field | What it is |
|---|---|
| `title` | Canonical article title |
| `url` / `canonicalUrl` | Article URL and canonical URL |
| `displayTitle` | Title as Wikipedia renders it |
| `summary` | Lead-section plain text |
| `fullText` | Complete article body, when enabled |
| `description` | One-line description in the article's language |
| `language` | Language edition code |
| `pageId` / `wikidataId` | Wikipedia page ID and Wikidata entity ID |
| `wordCount` | Words in the best available text |
| `categories` | Category names |
| `thumbnail` / `originalImage` | Lead image objects with `source`, `width`, `height` |
| `images` | Viewable URLs of images used in the article |
| `coordinates` | `latitude` and `longitude` for geographic subjects |
| `languageCount` / `availableLanguages` | How many other editions exist, and their codes |
| `lastModified` / `revisionId` / `lastEditor` / `lastEditComment` / `revisionSize` | Latest revision metadata |
| `isDisambiguation` | Present and true for disambiguation pages |
| `redirectedFrom` | The input that redirected here |
| `sections` | Heading outline (`title`, `level`, `anchor`) |
| `externalLinks` | Outbound URLs cited or listed by the article |
| `links` | Titles of linked Wikipedia articles |
| `referencesCount` | Number of inline citations |
| `pageviews` | `granularity`, `start`, `end`, `total`, and `points` (`date`, `views`) |
| `searchQuery` / `searchRank` / `searchSnippet` | Search provenance when the article came from a keyword |
| `requestedTitle` / `requestedTitles` / `requestedUrls` / `matchedSearchQueries` | All inputs that resolved to this article |
| `sourceCategory` | Category that produced the record, when applicable |
| `scrapedAt` | Capture timestamp |

Fields the source does not have for a particular article are omitted, never filled with `null`, `""`, `[]` or `0`.

### Inputs

| Field | Type | Default | Purpose |
|---|---|---|---|
| `articleUrls` | list | – | Article URLs to look up |
| `articleTitles` | list | – | Exact titles to look up in `language` |
| `searchQueries` | list | – | Keyword searches |
| `maxArticlesPerQuery` | 1–500 | `5` | Results per search query |
| `categoryNames` | list | – | Categories to browse, with or without `Category:` |
| `maxArticlesPerCategory` | 1–500 | `20` | Members per category |
| `language` | 374 codes | `en` | Edition for titles, searches and categories |
| `maxItems` | 1–10000 | `100` | Total record cap |
| `includeFullContent` | boolean | `false` | Add `fullText` |
| `includeSections` | boolean | `false` | Add `sections` |
| `includeExternalLinks` | boolean | `false` | Add `externalLinks` |
| `includeLinks` | boolean | `false` | Add `links` |
| `includeReferences` | boolean | `false` | Add `referencesCount` |
| `includePageviews` | boolean | `false` | Add `pageviews` |
| `pageviewsGranularity` | monthly / daily | `monthly` | Pageview point size |
| `pageviewsPeriods` | 1–365 | `12` | Months (max 12) or days |

Older saved tasks keep working: keys such as `urls`, `titles`, `pageTitles`, `query`, `searchQuery`, `maxResultsPerSearch`, `maxSearchResults`, `lang`, `includeFullArticle` and `fetchFullArticle` are read and mapped inside the actor even though they are not shown in the form.

### Examples

Look up two URLs:

```json
{
  "articleUrls": [
    "https://en.wikipedia.org/wiki/Albert_Einstein",
    "https://de.wikipedia.org/wiki/Berlin"
  ]
}
```

Search, with enrichment:

```json
{
  "searchQueries": ["quantum computing"],
  "maxArticlesPerQuery": 10,
  "language": "en",
  "includeFullContent": true,
  "includeSections": true,
  "includePageviews": true,
  "pageviewsGranularity": "monthly",
  "pageviewsPeriods": 6
}
```

Browse a category:

```json
{
  "categoryNames": ["Physics"],
  "maxArticlesPerCategory": 50,
  "language": "en",
  "includeExternalLinks": true
}
```

Mixed run with titles, URLs and a search:

```json
{
  "articleUrls": ["https://ja.wikipedia.org/wiki/東京"],
  "articleTitles": ["Python (programming language)", "Alan Turing"],
  "searchQueries": ["history of computing"],
  "maxItems": 25,
  "includeReferences": true
}
```

### Data source and attribution

The actor reads Wikimedia's MediaWiki Action API, its parse API, and the Wikimedia pageview API. Wikipedia text is available under CC BY-SA; keep the source attribution when you republish it. This actor is independent and is not affiliated with or endorsed by the Wikimedia Foundation.

### FAQ

**Do I need a key, login or proxy?**
No. All four lookup paths work anonymously from an Apify container.

**Which language editions are supported?**
The 374 language codes Wikimedia lists, from `en` and `de` to `zh-min-nan` and `simple`. Canonical and legacy codes map to the same edition. URL lookups take the edition from the URL; the `language` field applies to titles, searches and categories.

**Why is `summary` shorter than `fullText`?**
`summary` is the lead section. `fullText` is the whole article and is only requested when you switch it on.

**Can I get pageviews for any period?**
Yes — up to 12 monthly points or 365 daily points. The current partial month is included; daily data ends at the most recent day Wikimedia has published (usually two days ago).

**What are the hard limits?**
Search returns at most 500 hits per query; categories, external links, internal links and language links are capped at 500 values per article, and images at 50. `referencesCount` counts inline citations but does not return the citation text. Rendered HTML and infobox key/value extraction are intentionally not part of this actor.

**What happens to missing or non-article pages?**
Pages the API reports as missing are skipped and logged. Disambiguation pages are returned with `isDisambiguation: true` so you can filter them downstream.

**Does it work with old tasks created before the revamp?**
Yes. The four original inputs keep their names, and earlier alias keys are mapped in code.

# Actor input Schema

## `articleUrls` (type: `array`):

Wikipedia article URLs to look up. Works with desktop, mobile and index.php URLs, and with any language edition. Example: https://en.wikipedia.org/wiki/Albert_Einstein

## `articleTitles` (type: `array`):

Exact article titles to look up in the selected language edition. Spaces or underscores are both accepted; redirects are followed. Example: Albert Einstein.

## `searchQueries` (type: `array`):

Keywords to search with Wikipedia's full-text search. Returns the top-ranked matching articles per query.

## `maxArticlesPerQuery` (type: `integer`):

Maximum search results to fetch for each query (1-500).

## `categoryNames` (type: `array`):

Wikipedia category names to browse, with or without the Category: prefix. Each member page becomes an article record.

## `maxArticlesPerCategory` (type: `integer`):

Maximum category members to fetch for each category (1-500).

## `language` (type: `string`):

Wikipedia language edition for titles, searches and categories. URL lookups use the language in each URL instead.

## `maxItems` (type: `integer`):

Hard cap on total article records emitted across all modes.

## `includeFullContent` (type: `boolean`):

Add the complete article body as plain text in fullText (not only the lead summary).

## `includeSections` (type: `boolean`):

Add the article's heading outline (title, level, anchor) in sections.

## `includeExternalLinks` (type: `boolean`):

Add the outbound external URLs cited or listed by the article in externalLinks.

## `includeLinks` (type: `boolean`):

Add the titles of other Wikipedia articles linked from the article in links.

## `includeReferences` (type: `boolean`):

Add the number of inline citations in referencesCount.

## `includePageviews` (type: `boolean`):

Add a pageview series and total in pageviews, from Wikimedia's pageview API.

## `pageviewsGranularity` (type: `string`):

Monthly or daily pageview points. Used when Include pageviews is on.

## `pageviewsPeriods` (type: `integer`):

Number of pageview periods to return: 1-12 months for monthly, or 1-365 days for daily.

## Actor input object example

```json
{
  "articleUrls": [
    "https://en.wikipedia.org/wiki/Python_(programming_language)"
  ],
  "maxArticlesPerQuery": 5,
  "maxArticlesPerCategory": 20,
  "language": "en",
  "maxItems": 100,
  "includeFullContent": false,
  "includeSections": false,
  "includeExternalLinks": false,
  "includeLinks": false,
  "includeReferences": false,
  "includePageviews": false,
  "pageviewsGranularity": "monthly",
  "pageviewsPeriods": 12
}
```

# Actor output Schema

## `articles` (type: `string`):

Dataset containing every matched article record.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "articleUrls": [
        "https://en.wikipedia.org/wiki/Python_(programming_language)"
    ],
    "maxArticlesPerQuery": 5,
    "maxArticlesPerCategory": 20,
    "language": "en",
    "maxItems": 100,
    "includeFullContent": false,
    "includeSections": false,
    "includeExternalLinks": false,
    "includeLinks": false,
    "includeReferences": false,
    "includePageviews": false,
    "pageviewsGranularity": "monthly",
    "pageviewsPeriods": 12
};

// Run the Actor and wait for it to finish
const run = await client.actor("vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "articleUrls": ["https://en.wikipedia.org/wiki/Python_(programming_language)"],
    "maxArticlesPerQuery": 5,
    "maxArticlesPerCategory": 20,
    "language": "en",
    "maxItems": 100,
    "includeFullContent": False,
    "includeSections": False,
    "includeExternalLinks": False,
    "includeLinks": False,
    "includeReferences": False,
    "includePageviews": False,
    "pageviewsGranularity": "monthly",
    "pageviewsPeriods": 12,
}

# Run the Actor and wait for it to finish
run = client.actor("vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "articleUrls": [
    "https://en.wikipedia.org/wiki/Python_(programming_language)"
  ],
  "maxArticlesPerQuery": 5,
  "maxArticlesPerCategory": 20,
  "language": "en",
  "maxItems": 100,
  "includeFullContent": false,
  "includeSections": false,
  "includeExternalLinks": false,
  "includeLinks": false,
  "includeReferences": false,
  "includePageviews": false,
  "pageviewsGranularity": "monthly",
  "pageviewsPeriods": 12
}' |
apify call vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vexaloom-labs/wikipedia-article-lookup-by-url-or-keyword"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/s4H7ME7rlR9oYbY4e/builds/hds0Vqxg864gUIFG1/openapi.json
