Please add new feature to allow to choose namespace(s) of links on such page.
Eg. get all links to Help ns only on Wikipedia:Foo page.
Thanks
Version: unspecified
Severity: enhancement
Danny_B | |
Jun 15 2007, 3:18 PM |
F4147: prop-links-namespacefilter.patch | |
Nov 21 2014, 9:52 PM |
Please add new feature to allow to choose namespace(s) of links on such page.
Eg. get all links to Help ns only on Wikipedia:Foo page.
Thanks
Version: unspecified
Severity: enhancement
Some examples of possible code:
api.php? ... &plnamespaces=10 -- show only links to the pages in namespace 10
api.php? ... &plnamespaces=1|3|5|7|9|11 show only links to all talks
etc...
I'll work on it some time this weekend, patch should be ready by Monday (possibly earlier if I have time).
Created attachment 3791
Implements filtering by namespace for prop=links and prop=templatelinks
Miraculously, I've actually found time to do this today. The attached patch (tested and found to work) implements a plnamespace parameter just like you asked for. Because prop=links and prop=templatelinks share code, prop=templatelinks now also has a tlnamespace parameter which does exactly the same thing. Help text from the patched version:
Parameters:
plnamespace - Show links in this namespace(s) only Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Examples:
Get links from the [[Main Page]]: api.php?action=query&prop=links&titles=Main%20Page Get information about the link pages in the [[Main Page]]: api.php?action=query&generator=links&titles=Main%20Page&prop=info Get links from the Main Page in the User and Template namespaces: api.php?action=query&prop=links&titles=Main%20Page&plnamespace=2|10
Generator:
This module may be used as a generator
Parameters:
tlnamespace - Show templates in this namespace(s) only Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Examples:
Get templates from the [[Main Page]]: api.php?action=query&prop=templates&titles=Main%20Page Get information about the template pages in the [[Main Page]]: api.php?action=query&generator=templates&titles=Main%20Page&prop=info Get templates from the Main Page in the User and Template namespaces: api.php?action=query&prop=templates&titles=Main%20Page&tlnamespace=2|10
Generator:
This module may be used as a generator
It may take some time for this patch to be accepted into the code, but if you really want to try it you can of course set up your own test wiki and apply this patch to it.
Hope this helps,
Roan Kattouw
Attached:
Change 312721 had a related patch set uploaded (by Vyeshwanth):
pywikibot.Page.put: checking the changes before saving
Sorry I wrote a wrong bug no. This is supposed to be for Bug: T122715
I changed the bug number in the commit message now.
Sorry!