如何通过 API 从维基百科页面获取坐标? [英] How to get coordinates from a Wikipedia page through API?

查看:25
本文介绍了如何通过 API 从维基百科页面获取坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过他们的 API 获取维基百科页面的坐标.我想将页面标题作为titles"参数.我已经搜索了解决方案,但似乎他们正在取消页面然后提取.可以通过他们的 API 实现吗?

I want to get the coordinates of a Wikipedia page through their API. I want to put the page title as 'titles' parameter. I have searched SO for a solution but seems they are scrapping the page then extracting. Is it possible through their API?

推荐答案

您需要使用 维基百科 API.对于您使用 Kinkaku-ji 的示例,查询将是:

You need to use Wikipedia API. For your example with Kinkaku-ji the query will be:

https://en.wikipedia.org/w/api.php?action=query&prop=coordinates&titles=Kinkaku-ji

对于多个标题,使用竖线分隔它们:titles=Kinkaku-ji|Paris|...

For more than one title use pipe to separate them: titles=Kinkaku-ji|Paris|...

这篇关于如何通过 API 从维基百科页面获取坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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