我想从这个wiki页面https://en.wikipedia.org/wiki/Outline_of_academic_disciplines中提取学科列表,我想知道如何使用Wikipedia API来实现它。
但这只检索文章的第一部分,我想检索内容部分,所以结果看起来像这样:
decimal totalValue = 0;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView row = e.Row.DataItem as DataRowView;
totalValue += Convert.ToDecimal(row["tocht_id"]);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
if (totalValue == 100)
{
Button button = e.Row.FindControl("btnUpdatePCTD") as Button;
button.Enabled = false;
}
Label label = e.Row.FindControl("grandTotalPCT") as Label;
label.Text = string.Format("{0:N2}", GridView1.Rows.Count);
}
}
这可能使用维基百科API吗?
答案 0 :(得分:1)
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"
},
...