如何使用 MediaWiki API 获取所有维基百科文章标题?

How to get all Wikipedia article titles with MediaWiki API?

我知道您可以从 Wikipedia Database dump and that you can query for specific titles 获取所有标题,但是如何通过 MediaWiki API 获取所有标题?

为此你可以使用 Allpages API:

https://en.wikipedia.org/w/api.php?action=query&format=json&list=allpages&aplimit=max

您不会一次获得全部,最多 500 at a time and then a continuation marker which you can use for next batch of titles。继续此操作,直到 JSON 在答案的开头没有 query-continue