1
鑑於WikipediaAPI,一篇文章的在英文維基百科的標題,我上午網址提供回JSON:JS&WikipediaAPI:檢索文章的介紹?
var url = "http://en.wikipedia.org/w/api.php?action=query&prop=description&titles=Unicorn&prop=extracts&exsentences=10&explaintext&format=json";
的迴應是這樣的:
{
"query": {
"pages": {
"ramdom_number_here": {
"pageid": ramdom_number_here,
"ns": 0,
"title": "Unicorn",
"extract": "The unicorn is a legendary animal that has been described since antiquity as a beast with a large, pointed, spiraling horn projecting from its forehead."
}
}
}
}
鑑於<ramdom_number_here>
每篇文章的變化因此是不可預測的。
如何把握extract
或title
的值重用呢?