Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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

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?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
448 views
Welcome To Ask or Share your Answers For Others

1 Answer

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]

or

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

No need for scraping.

Cheers

G

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...