2016-12-07 66 views
0

我對api系統非常陌生,我想知道如何從某個頁面獲取數據。所以我的鏈接是:從某個頁面獲取數據信息 - MediaWiki API

https://nookipedia.com/w/api.php

,但我想從這個頁面讓我的API:

https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf

但是當我嘗試這個辦法:

https://nookipedia.com/wiki/Bugs/Animal_Crossing:_New_Leaf/w/api.php 

的鏈接沒有按沒有工作,給了我這個錯誤:

Error 404: Not found 

The requested page or file could not be found on our server. It may have been moved or deleted. 

我如何得到某個頁面?

回答

2

我建議你玩弄維基百科上的API sandbox,看看如何構建查詢。您仍然需要閱讀actual API documentation獲得有用信息......

基本上,你要的標題(S)作爲參數傳遞給api.php,像這樣:

https://nookipedia.com/w/api.php?titles=Bugs/Animal_Crossing:_New_Leaf 

然而,這將自己還沒有得到任何信息;你需要知道什麼你想要的數據,並使用正確的API模塊與適當的參數。例如,爲了獲得一個頁面的所有類別:

https://nookipedia.com/w/api.php?action=query&titles=Bugs/Animal_Crossing:_New_Leaf&prop=categories 

對於這個具體的例子,你可以看到查詢API文檔和類別屬性: