我如何从 mediawiki API 获取特定人的所有引语列表?

How do I get a list of all of the quotes for a particular person from the mediawiki API?

我正在尝试从 mediawiki api 获取 Kurt Cobain 的所有引述列表。我有:

https://en.wikiquote.org/w/api.php?format=json&action=query&srsearch=Kurt+Cobain&list=search

但是,它似乎没有给我任何他的报价,如图所示 here...也没有提供能够轻松解析的良好格式。

如何使用 API 获取他所有引述的列表?如果可能,还想包括来源 - 例如From an interview on MTV with Zeca Camargo, 1993-01-21, Rio de Janeiro, Brazil

更喜欢直接 API 但 pywikibot 的答案也不错。

没有像模板这样的结构化数据来获取报价。您所能做的就是通过正则表达式从纯维基文本中检索引号,例如:

>>> import pywikibot
>>> s = pywikibot.Site('en', 'wikiquote')
>>> p = pywikibot.Page(s,'Kurt Cobain')
>>> t = p.text
>>> for quote in t.splitlines():
        if quote.startswith('* '):
            print(quote)