Get WOEID on behalf of the city?

I used the Google Weather API to get weather information, but it seems Google has stopped serving. And now I'm trying to switch to the Yahoo Weather API.

var WOEID = 2502265;  //random WOEID
$.ajax({
    url: "http://weather.yahooapis.com/forecastjson?w=" + WOEID + "&u=c",
    dataType: 'json',
    success: function(data) {
        console.log(data);
    }
});

However, is there a way that I can only get the WOEID using JavaScript? Because then I can just do

http://www.google.com/ig/api?hl=en&weather=NYC

and what is he.

He says on the Yahoo weather API page ,

To find your WOEID, search or find your city on the weather home page. The WOEID is in the URL of the forecast page for this city. You can also get a WOEID by entering your zip code on the home page.

But I want to get it via JavaScript, and not manually go to weather.yahoo.com and find out WOEID.

Cross-Origin, Chrome, .

+6
4

, ,

WOEID , javascript ajax calls

URL- -, GeoPlanet WOEID

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

Direct YQL, - ( URL- ) ajax-

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

2018 :

Be sure to use the Direct YQL technique mentioned above @ aravind.udayashankara. I fiddled with the yboss API for a while, only to see that it was discontinued ( https://developer.yahoo.com/boss/search/ ), although Yahoo still has a lot of documentation on it on the Internet.

Instead, try the following (it starts from the page, but there is code in the URL).

yourLocation = "location" (zip, city name, etc.)

urlQuery = "https://query.yahooapis.com/v1/public/yql?q=select+*+from+geo.places+where+text%3D%22" + yourLocation + "%22&format=json"
0
source

To get Woeid by city name

using (WebClient wc = new WebClient())
{
string results = wc.DownloadString("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22" + CityName + "%22&format=xml");
}

See this article for more details.

-1
source

All Articles