如何在python中从pywikibot获取重定向
我想知道如何在python中从pywikibot获取重定向,python,pywikibot,Python,Pywikibot,我想知道pywikibotapi是否允许检索给定维基百科文章的重定向 我尝试了以下方法 pw.Page(pw.Site('en'), 'forensics').showRedirects() pw.Page(pw.Site('en'), 'forensics').redirects() 但是,我在说AttributeError时出错:“Page”对象没有属性“showRedirects” 如果需要,我很乐意提供更多详细信息。使用: 旁注:还有: 但是这与反向链接不同page.getRefer
pywikibot
api是否允许检索给定维基百科文章的重定向
我尝试了以下方法
pw.Page(pw.Site('en'), 'forensics').showRedirects()
pw.Page(pw.Site('en'), 'forensics').redirects()
但是,我在说AttributeError时出错:“Page”对象没有属性“showRedirects”
如果需要,我很乐意提供更多详细信息。使用:
旁注:还有: 但是这与反向链接不同
page.getReferences(filter\u redirects=True)
返回不正确的页面
- 重定向(但不必重定向到
)页面
- 包含对
页面的引用
#Redirect[[C]]
{{B}}
此页面将通过页面(站点“B”).getReferences(filter\u redirects=True)
返回,但不会通过页面(站点“B”).backlinks(filter\u redirects=True)
返回
page.getReferences(filter_redirects=True)
#Redirect[[C]]
{{B}}