使用维基百科API从页面检索内容列表
问题描述:
我想从此维基页面https://en.wikipedia.org/wiki/Outline_of_academic_disciplines中提取学科列表,我想知道如何使用维基百科API执行此操作。使用维基百科API从页面检索内容列表
但这仅检索文章的第一部分,我想要检索的内容部分,这样的结果会是这个样子:
{
Arts : {
"Performing Arts" : [all its sub-child],
"Visual arts" : [all its sub-child]
}
Geography: {....}
}
这可能使用维基百科API吗?
答
action=parse&format=json&page=Outline_of_academic_disciplines&prop=sections:
"sections": [
{
"toclevel": 1,
"level": "2",
"line": "Arts",
"number": "1",
"index": "1",
"fromtitle": "Outline_of_academic_disciplines",
"byteoffset": 1241,
"anchor": "Arts"
},
{
"toclevel": 2,
"level": "3",
"line": "Performing arts",
"number": "1.1",
"index": "2",
"fromtitle": "Outline_of_academic_disciplines",
"byteoffset": 1279,
"anchor": "Performing_arts"
},
...