https://bugzilla.wikimedia.org/show_bug.cgi?id=70492
Bug ID: 70492 Summary: Make Page.interwiki() use api instead of parsing the text Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: maarten@mdammers.nl Web browser: --- Mobile Platform: ---
In page.py in the Page object we have the following function: https://git.wikimedia.org/blob/pywikibot%2Fcore.git/aba68924c8221f111fa28ebd...
def interwiki(self, expand=True): """Iterate interwiki links in the page text, excluding language links.
@param expand: if True (default), include interwiki links found in templates transcluded onto this page; if False, only iterate interwiki links found in this page's own wikitext @type expand: bool
@return: a generator that yields Link objects """ # This function does not exist in the API, so it has to be # implemented by screen-scraping
The MediaWiki api now has the function "iwlinks" (https://www.mediawiki.org/wiki/API:Iwlinks) that seems to do what we need. See for example https://commons.wikimedia.org/w/api.php?action=query&prop=iwlinks&ti...
The interwiki() function should be reimplemented using the api.
https://bugzilla.wikimedia.org/show_bug.cgi?id=70492
Maarten Dammers maarten@mdammers.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23524
--- Comment #1 from Maarten Dammers maarten@mdammers.nl --- Added the bug (23524) in which this was added. Shipped as part of MediaWiki 1.17
https://bugzilla.wikimedia.org/show_bug.cgi?id=70492
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jayvdb@gmail.com
--- Comment #2 from John Mark Vandenberg jayvdb@gmail.com --- One problem is the API doesnt support 'expand=False' behaviour. The API always includes all interlinks. in your example
{ "prefix": "w", "*": "Wikipedia:Transclusion" },
A recent attempt to use both the API and textlib in the same Page method resulted in a stalemated patch with +2/-2: https://gerrit.wikimedia.org/r/#/c/148619/
pywikipedia-bugs@lists.wikimedia.org