On 13 February 2012 16:28, John R. Frank <jrf@mit.edu> wrote:
Is there a method for getting the inbound redirects that point to a page?
For example, given the urlname=Death_of_Michael_Jackson, how do I get the pages that redirect to it?
>>> print wikipedia.Page.getReferences.__doc__
Yield all pages that link to the page by API
If you need a full list of referring pages, use this:
pages = [page for page in s.getReferences()]
Parameters:
* follow_redirects - if True, also returns pages that link to a
redirect pointing to the page.
* withTemplateInclusion - if True, also returns pages where self is
used as a template.
* onlyTemplateInclusion - if True, only returns pages where self is
used as a template.
* redirectsOnly - if True, only returns redirects to self.
>>> references = wikipedia.Page('en', 'Death_of_Michael_Jackson').getReferences(redirectsOnly=True)
>>> references.next()
Getting references to [[en:Death of Michael Jackson]] via API...
Page{[[en:Reaction to the death of Michael Jackson]]}
>>> references.next()
Page{[[en:Tohme Tohme]]}
>>> references.next()
Page{[[en:Michael Jackson's death]]}
>>> references.next()
Page{[[en:Death of michael jackson]]}
>>> references.next()
Page{[[en:R.i.p michael jackson]]}
>>> references.next()
Page{[[en:Ed Chernoff]]}
>>> references.next()
Page{[[en:Life and death of Michael Jackson]]}
>>> references.next()
Page{[[en:Michael Jackson Family Trust]]}
Best,
Merlijn