Class: CategoryLoader

CategoryLoader(sourceUrl)

Encapsulates utility methods for a given mediawiki-compatible source

Constructor

new CategoryLoader(sourceUrl)

Initalizes CategoryLoader class
Parameters:
Name Type Description
sourceUrl string
Source:

Methods

(static) createFromTemplate(urlTemplate, languageCode) → {CategoryLoader}

Creates a CategoryLoader object from an language-independent url-template (mustache style). Common templates are available in exported member MwSources
Parameters:
Name Type Description
urlTemplate string mustache syntax
languageCode string mediawiki compatible language code
Source:
Returns:
Type
CategoryLoader
Example
CategoryLoader.createFromTemplate(
  'https://{{language}}.wikipedia.org/w/api.php',
  'en'
)

(static) createFromUrl(sourceUrl) → {CategoryLoader}

Creates a CategoryLoader object from an complete url to the api
Parameters:
Name Type Description
sourceUrl string
Source:
Returns:
Type
CategoryLoader
Example
CategoryLoader.createFromUrl('https://en.wikipedia.org/w/api.php')

loadMembers(categoryTitle) → {Promise}

Retrieves all category members (but not from their subcategories)
Parameters:
Name Type Description
categoryTitle string
Source:
Returns:
Array of type CategoryItem
Type
Promise