Wikimedia Commons Category Hierarchy Scraper
Pricing
from $3.62 / 1,000 results
Wikimedia Commons Category Hierarchy Scraper
Recursively scrapes Wikimedia Commons category trees from a start category. Returns parent-child relationships with page IDs and namespaces for building taxonomies or knowledge graphs.
Pricing
from $3.62 / 1,000 results
Rating
0.0
(0)
Developer
ParseForge
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Share
Wikimedia Commons Category Hierarchy Scraper
Scrape the Wikimedia Commons category hierarchy from any starting category, up to 10 levels deep. Extract every subcategory title, page ID, and namespace, and reconstruct the full tree structure. Export to CSV, JSON, Excel, or XML.
Wikimedia Commons holds millions of freely licensed media files, organized across a large category tree. Manually navigating or mapping this hierarchy is slow and impractical. This Actor queries the official Wikimedia API to recursively extract category structures, giving you a clean dataset of parent-child relationships without writing a script.
| Who uses it | What they scrape Wikimedia Commons for |
|---|---|
| Digital archivists | Mapping the organizational structure of a public domain media collection. |
| Data scientists | Building a knowledge graph or taxonomy from Wikimedia Commons category relationships. |
| SEO analysts | Understanding how a large media repository categorizes topics for content strategy. |
| Researchers | Analyzing the distribution and depth of categories within a specific domain. |
What it does
This Actor collects Wikimedia Commons subcategory titles and IDs from a starting category, recursively traversing the tree up to a specified depth, and returns each category relationship as a flat row.
- Recursive tree traversal: Start from any category and drill down through multiple levels of subcategories.
- Configurable depth limit: Control how deep the scraper goes, from a single level of children up to 10 levels.
- Structured output: Each row captures a parent category, its child subcategory, page ID, and namespace.
Results export to CSV, JSON, Excel, or XML, or straight from the API.
What you can do with Wikimedia Commons data
Map a media collection's structure.
A digital archivist starts from 'Category:Photographs by topic' and extracts the full subcategory tree to understand how millions of images are organized.
Build a training taxonomy.
A machine learning engineer scrapes the category hierarchy under 'Category:Animals' to create a labeled dataset for hierarchical classification models.
Audit category coverage.
An SEO analyst extracts the subcategories of 'Category:Diagrams' to identify content gaps and plan new visual assets for a website.
Why choose this scraper
| What you get | |
|---|---|
| Official API access | Reads directly from the public Wikimedia API with no authentication or API key required. |
| Recursive extraction | Automatically follows subcategory links to build a complete hierarchy from your chosen root. |
| Clean relational output | Returns parent-child pairs ready to import into graph databases or taxonomy tools. |
What a Wikimedia Commons record looks like
Every record returns as one flat JSON row. Here is a real one from a run:
{"pageid": 198793313,"ns": 14,"title": "Category:Categories by former function","depth": 1,"parentTitle": "Category:Categories","scrapedAt": "2026-09-04T00:45:59.430Z"}
Every value above comes from a real run. A field a record does not have comes back as null.
Configure the run
Drive the Actor by providing a single start category title, and set the maximum recursion depth to control how far down the tree it traverses. The Input tab lists every parameter.
A first run with the defaults:
{"startCategory": "Category:Categories","maxDepth": 2,"maxItems": 10}
A larger pull:
{"startCategory": "Category:Categories","maxDepth": 2,"maxItems": 200}
Free users
Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.
Run it
- Create a free Apify account.
- Open the Wikimedia Commons Category Hierarchy Scraper.
- Set your inputs and any filters, then click Start.
- Export the results as CSV, Excel, JSON, or XML from the Dataset tab.
Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.
Use with AI agents (MCP)
Give an AI agent live access to Wikimedia Commons through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:
$claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/wikimedia-commons-category-scraper"
Then prompt it in plain language to run the scraper and read back the results.
Troubleshooting
Why am I getting no results?
Check that your start category title includes the exact 'Category:' prefix and matches an existing category on Wikimedia Commons. Also verify that the category contains subcategories; some leaf categories have none.
The run is taking too long or timing out.
Large category trees can take time to traverse. Reduce the maxDepth setting to limit how many levels the Actor follows, or lower the maxItems count to stop after a certain number of results.
I see duplicate rows in my output.
A subcategory can belong to multiple parent categories on Wikimedia Commons. The Actor records each parent-child relationship it finds, which may result in the same child appearing under different parents. This reflects the real category structure.
The scraper stopped before reaching the maxDepth I set.
The Actor respects the maxItems limit first. If it reaches the maximum number of items before exhausting the depth, it will stop. Increase the maxItems value to allow deeper traversal.
FAQ
| Question | Answer |
|---|---|
| Do I need a Wikimedia account or API key to use this scraper? | No. The Actor uses the public, unauthenticated Wikimedia API, so no login, account, or API key is required. |
| How many levels of subcategories can I scrape? | You can set the maximum recursion depth from 1 up to 10. A depth of 1 returns only the direct children of your start category, while higher values traverse deeper into the tree. |
| What format is the output data in? | The dataset is returned as a flat table with parent and child category information. You can export it in CSV, JSON, Excel, or XML formats from the Apify platform. |
| Can I start from any Wikimedia Commons category? | Yes. Provide the full category title including the 'Category:' prefix, such as 'Category:Cities' or 'Category:Paintings', and the Actor will begin traversal from there. |
| Does this scraper download the actual media files? | No. This Actor extracts only the category hierarchy metadata, such as titles and IDs. It does not download images, videos, or other media files. |
| How is the category hierarchy represented in the output? | Each row represents a parent-child relationship between two categories, along with the child's page ID and namespace. You can reconstruct the full tree from these pairs. |
| Is there a limit to how many categories I can scrape? | Free users are limited to a preview of 10 items. Paid users can scrape up to 1,000,000 items per run, which is sufficient for very large category trees. |
| What is the 'namespace' field in the results? | The namespace indicates the type of page. For categories, this is typically 14. It helps you distinguish categories from other page types that might appear in the results. |
Related actors
Browse the full ParseForge collection for more scrapers.
🆘 Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.
Pricing
This Actor uses pay-per-result pricing: $0.004 per result collected. You are billed only for the results you receive, so a run that returns nothing costs nothing.
⚠️ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Wikimedia Foundation, Inc. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.
