gpt4 book ai didi

rss - 雅虎加拿大天气 RSS 提要

转载 作者:行者123 更新时间:2023-12-04 05:38:27 28 4
gpt4 key购买 nike

我的应用程序使用雅虎的天气信息 (XML) 来显示 future 5 天的天气预报。当邮政编码在美国时,这很有效。例如,下面的 url 为我提供了密歇根州富兰克林的提要。

http://xml.weather.yahoo.com/forecastrss/48025_f.xml

我也需要为加拿大提供类似的提要,但似乎无法让它发挥作用。例如,“Scarborough”的邮政编码是 M1M1M1。试过
http://xml.weather.yahoo.com/forecastrss/M1M1M1_f.xml

但这不起作用。

提前致谢

最佳答案

我正在可靠地使用:

http://weather.yahooapis.com/forecastrss?w=location

哪里 w = WOEIDScarborough, Canada w=4369所以:
http://weather.yahooapis.com/forecastrss?w=4369

将正确返回天气数据。有关 API 的更多信息 here .

我也在使用这种方法来获取 WOEID对于给定的位置名称字符串:
// Create new XML doc
XmlDocument xmldoc = new XmlDocument();
// Get XML doc
xmldoc.Load(string.Format("http://where.yahooapis.com/v1/places.q({0})?appid={1}", place, ApplicationID));
string woeid = xmldoc.GetElementsByTagName("woeid")[0].InnerText;
return woeid;

但要使其工作,您需要获得 ApplicationID来自 Yahoo通过注册您的应用程序。

关于rss - 雅虎加拿大天气 RSS 提要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11607150/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com