| For obtaining summaries in Wikimedia sites, thePage Content Service is used. |
Release status: stable | |
|---|---|
| Implementation | API |
| Description | Provides API with plain-text or limited HTML extracts of page content |
| Author(s) | Max Semenik (MaxSemtalk) |
| Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
| Database changes | No |
| License | GNU General Public License 2.0 or later |
| Download | |
| |
| Translate the TextExtracts extension if it is available at translatewiki.net | |
| Issues | Open tasks ·Report a bug |
TheTextExtracts extension provides an API which allows retrieval of plain-text or limited HTML (HTML with content forsome CSS classes removed) extracts of page content.
TextExtracts folder to yourextensions/ directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtractswfLoadExtension('TextExtracts');
$wgExtractsRemoveClasses is an array of <tag>, <tag>.class, .<class>, #<id> which will be excluded from extraction.$wgExtractsRemoveClasses[] = 'dl'; removes indented text, often used for non-templated hatnotes that are not desired in summaries.$wgExtractsExtendOpenSearchXml defines whether TextExtracts should provide its extracts to theOpensearch API module. The default isfalse.| extracts | |
|---|---|
| Returns plain-text or limited HTML extracts of the given pages This module cannot be used as agenerator. | |
| Prefix | ex |
| Required rights | none |
| Post only? | No |
| Generated help | Current |
| The following documentation is the output ofSpecial: |
Returns plain-text or limited HTML extracts of the given pages.
How many characters to return. Actual text returned might be slightly longer.
How many sentences to return.
How many extracts to return. (Multiple extracts can only be returned if exintro is set to true.)
Return only content before the first section.
Return extracts as plain text instead of limited HTML.
How to format sections in plaintext mode:
When more results are available, use this to continue. More detailed information on how to continue queriescan be found on mediawiki.org.
| Result |
|---|
{"query":{"pages":{"9228":{"pageid":9228,"ns":0,"title":"Earth","extract":"Earth, also called the world and, less frequently, Gaia, (or Terra in some works of science fiction)..."}}}} |
There are various things to be aware of when using the API or software that uses the API e.g.Extension:Popups.
TextExtracts will strip any element that is marked with the class.noexcerpt.This is provided by the$wgExtractsRemoveClasses configuration variable (which also definessome other excluded elements).
| This extension is being used on one or moreWikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia'sCommonSettings.php andInitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki'sSpecial:Version page. |
| This extension is included in the following wiki farms/hosts and/or packages:This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |