This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

Wikipedia Random Article by Category

Utilities · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — try it free, no account needed.
CategoryUtilities
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

This script lets you open random Wikipedia articles from specific categories. Instead of using Wikipedia's general "Random article" feature, you can choose a category and get a random article from that category. On any article page, the script detects the article's categories and provides a "Random from this category" button. On category pages, it offers to open a random article from that category or a random subcategory. You can also enter any category name manually. A "recent categories" list stores your most-used categories for quick access. This is perfect for exploring topics you're interested in, discovering new articles within a specific field, or for educational browsing where you want to stay within a subject area.

WHERE IT RUNS

The script runs on all Wikipedia domains (*.wikipedia.org). It works on article pages, category pages, and any page that displays category links. It supports both desktop and mobile views.

HOW TO USE

After installation, the settings panel appears on the left side of the screen with the gear emoji (⚙️). Open the panel to configure the script:

- The "Enable random category browsing" toggle enables or disables the script.

- The "Current Page" section shows the categories detected on the current page.

- Click "Random from this category" to open a random article from the current page's category.

- On category pages, click "Random subcategory" to open a random subcategory.

- Enter a category name in the "Custom Category" input and click "Random from this category" to open a random article from that category.

- The "Recent Categories" section shows your most-used categories. Click the 🎲 button next to any category to open a random article from it.

The script works automatically—just browse Wikipedia and use the panel to explore categories.

TECHNICAL SECTION — REAL MECHANISM

The script detects article pages by checking the URL for special page prefixes and looking for #firstHeading. Category pages are detected by the presence of "Category:" in the URL. Categories from the current page are extracted by scanning elements like #catlinks .mw-category a, .catlinks a, and .mw-normal-catlinks a for links containing "Category:" in their href. The category name is extracted from the link text. For custom category input, the script uses the category name as provided. The script fetches category members using Wikipedia's API (https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:{category}&cmlimit=max&origin=*). It filters the results to only include pages in the main namespace (ns=0). A random index is selected from the list, and the article title is used to construct a URL (https://en.wikipedia.org/wiki/{title}) which is opened in a new tab using GM_openInTab. Recent categories are stored as an array of strings via GM_setValue, with a limit of 20 entries. The "Random subcategory" feature uses the same API with cmtype=subcat to fetch subcategories.

THE PANEL

The settings panel is built with BotGentz's BGPanel component. It is draggable via its header, allowing you to reposition it anywhere on the screen. The panel snaps to the left edge by default but can be moved freely. Click the gear emoji to collapse the panel into a small bubble, and click the bubble to expand it again. The panel remembers its position per page session. Press the Escape key to quickly close or minimize the panel. The panel includes a status flash bar that provides visual feedback when settings are changed or actions are performed. All settings and recent categories save automatically via GM_setValue.

PLEASE NOTE

This script requires the free BotGentz browser extension to run. It does not function as a standalone Chrome extension and does not use chrome.* APIs. Wikipedia frequently updates its page structure, which may affect the selectors used to find category links. If the script stops working, please check for updates. The script uses the English Wikipedia API by default. For other language versions, the API URL would need to be adjusted. The API request may take a moment for categories with many pages. The script stores only your preferences and recent categories via GM_setValue. No data is sent externally except for the Wikipedia API request. The script never reads or writes password fields, hidden inputs, or file inputs. All DOM operations use safe methods (style properties, textContent, appendChild) and never use innerHTML.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.