android维基百科api游戏 [英] android Wikipedia api game

查看:131
本文介绍了android维基百科api游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我必须制作符合以下要求的应用:

Hi i have to make an app with the following requirement:

When the user opens the app, it displays the text from a random Wikipedia page. 
(You’re free to use any logic for grabbing text from a random Wiki 
page(preferably using REST APIs)) The game requires a minimum of 10 lines of 
text on the screen. However, we want to show complete paragraphs of text to 
make it easier to understand the content displayed. Use the least number of 
paragraphs required to cross the 10 sentence limit.

我能够从随机维基页面获取文本但很多时候文本少于10个句子而且确保我使用此网址的最少10个句子:

I am able to get text from random wiki page but many times text is less than 10 sentences and to ensure minimum 10 sentences i used this url:

http://en.wikipedia.org/w/api.php?action=query&prop=extracts& format = json& exintro =& generator = random& exsentences = 10

但是这个网址也没有按预期工作。

But this url is also not working as expected.

我如何解决这个问题,任何建议都会有所帮助。

How do i approach this problem any suggestions will help.

推荐答案

我在查询中注意到两件事。首先, exintro 意味着你只能从第一个标题获得句子。在此之前,只有少数文章有十句话。其次,您将从所有命名空间获得结果。通过使用 grnnamespace = 0 ,您只能获得文章。所以这样的事情可能适合你:

There are two things I notice in your query. First, the exintro means you only get sentences from over the first heading. Only a few articles have ten sentences before that. Second, you are getting results from all namespaces. By using grnnamespace=0 you will only get articles. So something like this might work for you:

https://en.wikipedia.org/w/api.php?action=query&format=json& prop = extract& generator = random& exsentences = 10& grnnamespace = 0

这篇关于android维基百科api游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆