I'm not sure people on this list are aware of all the possibilities available in recent releases of MediaWiki: * https://www.mediawiki.org/wiki/API:Parse * https://www.mediawiki.org/wiki/Extension:TextExtracts#API * https://www.mediawiki.org/wiki/Parsoid#The_Parsoid_web_API
Extracting text, e.g. word definitions, from wiki pages is a problem often discussed on this list and everyone has their approach: did you document your approach on mediawiki.org? It's important to share best practices and to make the MediaWiki community aware of your use cases, so that they can be kept in mind when developing APIs etc.
Nemo
wiktionary-l@lists.wikimedia.org