如何仅从维基媒体API获取文本?以及如何编辑CSS?

时间:2013-11-22 02:09:10

标签: css css3 wikipedia wikipedia-api

首先。如何用CSS渲染这个渲染? http://en.wikipedia.org/w/index.php?title=Albert_Einstein&action=render

二 我有e链接http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&titles=Stack%20Overflow

结果:

{"query":{"pages":{"21721040":{"pageid":21721040,"ns":0,"title":"Stack Overflow","extract":"<p><b>Stack Overflow</b> is a website, the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky, as a more open alternative to earlier Q&amp;A sites such as Experts Exchange. The name for the website was chosen by voting in April 2008 by readers of <i>Coding Horror</i>, Atwood's popular programming blog.</p>\n<p>It features questions and answers on a wide range of topics in computer programming. The website serves as a platform for users to ask and answer questions, and, through membership and active participation, to vote questions and answers up or down and edit questions and answers in a fashion similar to a wiki or digg. Users of Stack Overflow can earn reputation points and \"badges\"; for example, a person is awarded 10 reputation points for receiving an \"up\" vote on an answer given to a question, and can receive badges for their valued contributions, which represents a kind of gamification of the traditional Q&amp;A site or forum. All user-generated content is licensed under a Creative Commons Attribute-ShareAlike license.</p>\n<p>As of August 2013<sup class=\"plainlinks noprint asof-tag update\" style=\"display:none;\">[update]</sup>, Stack Overflow has over 1,900,000 registered users and more than 5,500,000 questions. Based on the type of tags assigned to questions, the top eight most discussed topics on the site are: C#, Java, PHP, JavaScript, Android, jQuery, C++ and Python.</p>\n<p></p>"}}}}

如果没有这个和其他字符,我怎么能给出?

{"query":{"pages":{"21721040":{"pageid":21721040,"ns":0,"title":"Stack Overflow","extract":"

1 个答案:

答案 0 :(得分:0)

你得到的东西是一个JSON对象。我不确定你是如何尝试使用这些数据的,但是你应该解析那个JSON并只得到那个对你很重要的部分:extract属性。