如何从 Wikipedia API 获取电影内容?
我试图从维基百科 API 获取电影《殿下》的描述,但它没有给我任何信息。
当我用谷歌搜索时“殿下”维基百科显示为第三个结果,这是我希望 API 提供给我的页面。
另外,我只想要电影描述的文本,不要混入维基语法或其他任何内容。
I tried to get the description of the movie "Your Highness" from the Wikipedia API but it gives me nothing.
When I google "Your Highness" wikipedia shows up as the third result, that's the page that I want the API to give me.
Also I just want the text of the description of the movie, no wiki-syntax mixed in or anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我之前错误地认为问题是一个空格 - 看起来它只是大写。如果我们只是将您的网址更改为使用
Your%20Highness
而不是your%20highness
,则可以:http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=Your%20Highness&prop=revisions&rvprop=content
编辑:虽然并非所有标题都是标题大小写(例如“The Name of the Rose”),如果您使用
&redirects
查询参数,它有时会有所帮助 -它确实对“玫瑰之名”有帮助,但出于某种原因对“殿下”没有帮助。不想说为什么,但这可能值得更多调查......I was wrong before about the problem being a space - it looks like it was just capitalization. If we just change your URL to use
Your%20Highness
instead ofyour%20highness
it works:http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=Your%20Highness&prop=revisions&rvprop=content
EDIT: While not all titles are title-cased (such as "The Name of the Rose") if you use the
&redirects
query parameter, it sometimes helps - it certainly helps in "the name of the rose" but not for "your highness" for some reason. Wouldn't like to say why, but it's probably worth more investigation...