I want try to get tennis players description from wikipedia without scratch the DOM page on a player x. It's not allowed and very boring. So, I hope someone can reply to my only question.
我想尝试从wikipedia获得网球运动员的描述,而不是划痕玩家x上的DOM页面。这是不允许的,也很无聊。所以,我希望有人可以回复我唯一的问题。
What can I do precisly with the Wikipedia API ? Can I get informations about a collection of tennis players easily ? or this API is not working for this. If not, I need someone tells me what is the purpose of this API because I don't understand the documentation.
我可以准确地使用*API做什么?我可以轻松获得有关网球运动员的信息吗?或者这个API不起作用。如果没有,我需要有人告诉我这个API的目的是什么,因为我不懂文档。
2 个解决方案
#1
2
Take a look at the Wikipedia API Sandbox - with that you can play around and try to get the info you need.
看看*API沙盒 - 你可以玩,并尝试获取所需的信息。
To get the info from a page, you can use the parse action.
要从页面获取信息,您可以使用解析操作。
Trying to get the information for the danish tennisplayer Caroline Wozniacki, I used the parse action along with the json format.
In the field labeled page I pasted Caroline_Wozniacki
and I pressed Make Request.
为了获得丹麦网球运动员Caroline Wozniacki的信息,我使用了解析动作和json格式。在标记页面的字段中,我粘贴了Caroline_Wozniacki并按下了Make Request。
This gives me this URL: http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Caroline_Wozniacki
This contains the page with links, references and all in JSON format.
这给了我这个URL:http://en.wikipedia.org/w/api.php?action =arse&format = json&page = Caroline_Wozniacki这包含带有链接,引用和所有JSON格式的页面。
#2
2
You can fetch an article like this:
你可以获取这样的文章:
http://en.wikipedia.org/w/index.php?title=*&printable=yes
or to use the API:
或使用API:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Stack%20Overflow&rvprop=content
this will get you the raw article code. To get the html version use action=parse
:
这将为您提供原始文章代码。要获取html版本,请使用action = parse:
http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Stack_Overflow
Also have a look at the documentation: http://www.mediawiki.org/wiki/API
另请查看文档:http://www.mediawiki.org/wiki/API
#1
2
Take a look at the Wikipedia API Sandbox - with that you can play around and try to get the info you need.
看看*API沙盒 - 你可以玩,并尝试获取所需的信息。
To get the info from a page, you can use the parse action.
要从页面获取信息,您可以使用解析操作。
Trying to get the information for the danish tennisplayer Caroline Wozniacki, I used the parse action along with the json format.
In the field labeled page I pasted Caroline_Wozniacki
and I pressed Make Request.
为了获得丹麦网球运动员Caroline Wozniacki的信息,我使用了解析动作和json格式。在标记页面的字段中,我粘贴了Caroline_Wozniacki并按下了Make Request。
This gives me this URL: http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Caroline_Wozniacki
This contains the page with links, references and all in JSON format.
这给了我这个URL:http://en.wikipedia.org/w/api.php?action =arse&format = json&page = Caroline_Wozniacki这包含带有链接,引用和所有JSON格式的页面。
#2
2
You can fetch an article like this:
你可以获取这样的文章:
http://en.wikipedia.org/w/index.php?title=*&printable=yes
or to use the API:
或使用API:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Stack%20Overflow&rvprop=content
this will get you the raw article code. To get the html version use action=parse
:
这将为您提供原始文章代码。要获取html版本,请使用action = parse:
http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Stack_Overflow
Also have a look at the documentation: http://www.mediawiki.org/wiki/API
另请查看文档:http://www.mediawiki.org/wiki/API