Your code needs several settings, the version is updated here:
$.getJSON("http://query.yahooapis.com/v1/public/yql?"+
"q=select%20woeid%20from%20geo.places%20where%20text%20%3D%20%22"+
"london"+
"%22&format=json&jsoncallback=json",
function(data){
if(data.query.results){
$.each(data.query.results.place, function(i, v) {
console.log("woeid #" + i + ": " + v["woeid"]);
});
}
});
results query, , woeid ... , , woeid, , , . .