Yahoo Weather API WOEID 检索 [英] Yahoo Weather API WOEID retrieval

查看:41
本文介绍了Yahoo Weather API WOEID 检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序 (PHP),它从免费的 RSS 提要中获取雅虎天气数据,并将其与基于从 RSS 提要中检索到的数据的颜色十六进制相关联.我遇到的问题是找到一种无需手动操作即可获取位置代码或 WOEID 的方法.

I'm creating an app (PHP) that takes yahoo weather data from the free RSS feed and correlates it with a colour hex based on data retrieved from the RSS feed. The issue I'm having is finding a way to grab the location code or WOEID without doing it manually.

只要您提供 WOEID,Yahoos API 就会发回 RSS 提要 -> http://weather.yahooapis.com/forecastrss?w=4097

Yahoos API sends back an RSS feed as long as you provide a WOEID -> http://weather.yahooapis.com/forecastrss?w=4097

这样做是否符合道德规范?我的初学者知识告诉我我必须编写一个脚本来使用该术语搜索雅虎并获取第一个 WOEID,但我认为雅虎不希望脚本这样做并且看起来过于复杂......如果没有,有没有其他选择可以让我更轻松的 API?

Is there an ethical way of doing this? My beginner knowledge tells me I have to write a script that would search yahoo using the term and grab the first WOEID, but I would assume yahoo doesn't want scripts doing this and it seems overcomplicated... If not, are there any alternative APIs that would make this easier on me?

谢谢!

推荐答案

为什么不直接使用 Yahoo!GeoPlanet 服务将一个地方解析为 WOEID?或者使用 YQL 服务通过它的表访问 GeoPlanet?

Why not just use the Yahoo! GeoPlanet service to resolve a place to a WOEID? Or use the YQL service to access GeoPlanet via it's table?

http://where.yahooapis.com/v1/places.q('Barrie CA')?appid=[yourappidhere]

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22Barrie%20CA%22&format=xml

无需刮.

干杯

G

(披露;我为 Yahoo! 工作,并且是 WOEID 和 GeoPlanet 背后小组的一员)

(Disclosure; I work for Yahoo! and am part of the group behind WOEIDs and GeoPlanet)

这篇关于Yahoo Weather API WOEID 检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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