雅虎天气API摄氏度? [英] yahoo weather api celsius?

查看:430
本文介绍了雅虎天气API摄氏度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

旨在试图获得与摄氏温度也加入雅虎我阿比天气&安培;û= C ,但它仍然在华氏

这是我使用的网址


  

<一个href=\"http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location=%22LEXX0003%22&format=json&u=c\">http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location=%22LEXX0003%22&format=json&u=c`


<$p$p><$c$c>{\"query\":{\"count\":1,\"created\":\"2014-01-13T13:06:43Z\",\"lang\":\"en-US\",\"results\":{\"channel\":{\"item\":{\"title\":\"Conditions贝鲁特,在LE下午1点59分EET\",\"lat\":\"33.82\",\"long\":\"35.48\",\"link\":\"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html\",\"pubDate\":\"Mon, 2014年1月13日下午1时59 EET,条件:{code:30,日期:周一,2014年1月13日下午1时59 EET,温度:64 文:晴间多云},说明:\\ n&LT; IMG SRC = \\HTTP://l.yimg.com/a/i/us/we/52/30.gif \\/ &GT;&LT; BR /&GT; \\ n&LT; b&GT;现状:&LT; / b&GT;&LT; BR /&GT; \\ nPartly多云,64 F&LT; BR /&GT; \\ n&LT; BR /&GT;&LT; b&GT;预测:LT; / b&GT;&LT; BR /&GT; \\ NMON - 晴间多云。高:64低:55℃; BR /&GT; \\ nTue - 阴天。高:66低:56&LT; BR /&GT; \\ nWed - 以晴为主。高:68低:58&LT; BR /&GT; \\清大 - 阳光。高:70低:60℃; BR /&GT; \\ nFri - 零星阵雨。高:65低:57&LT; BR /&GT; \\ n&LT; BR /&GT; \\ n&LT;一href=\\\"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html\\\">Full / A&GT;雅虎天气&LT预测及LT; BR /&GT;&LT; BR /&GT; \\ N(以&lt提供; A HREF = \\的http://www.weather.com \\&gt;在天气频道&LT; / A&GT;)&LT; BR /&GT; \\ N,预测:[{code:30,日期:2014年1月13日,天:星期一,高:64,低:55,文:晴间多云},{code:26,日期:2014年1月14日,日 :星期二,高:66,低:56,文:雷雨},{code:34,日期:2014年1月15日,天:星期三,高:68,低:58,文:晴},{code:32,日期:2014年1月16日,天:星期四,高:70,低:60,文:艳阳天},{code: 39,日期:2014年1月17日,天:星期五,高:65,低:57,文:零星阵雨}],GUID :{isPermaLink:假的,内容:LEXX0003_2014_01_17_7_00_EET}}}}}}`

什么想法?


解决方案

优于从不迟到......

  VAR locationQuery =逃生(选择从那里weather.forecast在WOEID(选择geo.places WOEID项,其中文本='GB-LND')和u ='C' )
    locationUrl =htt​​p://query.yahooapis.com/v1/public/yql?q=+ locationQuery +&放大器;格式= JSON和放大器;回调=?;

这是更容易,如果你打破它阅读。你我们是pretty接近,只是需要将U = C作为查询的一部分,而不是在URL的末尾。

aim trying to get Yahoo weather Api with Celsius temperature i did added &u=c but its still in Fahrenheit

this is the url i'm using

http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location=%22LEXX0003%22&format=json&u=c`

{"query":{"count":1,"created":"2014-01-13T13:06:43Z","lang":"en-US","results":{"channel":{"item":{"title":"Conditions for Beirut, LE at 1:59 pm EET","lat":"33.82","long":"35.48","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html","pubDate":"Mon, 13 Jan 2014 1:59 pm EET","condition":{"code":"30","date":"Mon, 13 Jan 2014 1:59 pm EET","temp":"64","text":"Partly Cloudy"},"description":"\n<img src=\"http://l.yimg.com/a/i/us/we/52/30.gif\"/><br />\n<b>Current Conditions:</b><br />\nPartly Cloudy, 64 F<BR />\n<BR /><b>Forecast:</b><BR />\nMon - Partly Cloudy. High: 64 Low: 55<br />\nTue - Cloudy. High: 66 Low: 56<br />\nWed - Mostly Sunny. High: 68 Low: 58<br />\nThu - Sunny. High: 70 Low: 60<br />\nFri - Scattered Showers. High: 65 Low: 57<br />\n<br />\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Beirut__LE/*http://weather.yahoo.com/forecast/LEXX0003_f.html\">Full Forecast at Yahoo! Weather</a><BR/><BR/>\n(provided by <a href=\"http://www.weather.com\" >The Weather Channel</a>)<br/>\n","forecast":[{"code":"30","date":"13 Jan 2014","day":"Mon","high":"64","low":"55","text":"Partly Cloudy"},{"code":"26","date":"14 Jan 2014","day":"Tue","high":"66","low":"56","text":"Cloudy"},{"code":"34","date":"15 Jan 2014","day":"Wed","high":"68","low":"58","text":"Mostly Sunny"},{"code":"32","date":"16 Jan 2014","day":"Thu","high":"70","low":"60","text":"Sunny"},{"code":"39","date":"17 Jan 2014","day":"Fri","high":"65","low":"57","text":"Scattered Showers"}],"guid":{"isPermaLink":"false","content":"LEXX0003_2014_01_17_7_00_EET"}}}}}}`

any ideas ?

解决方案

Better late than never...

var locationQuery = escape("select item from weather.forecast where woeid in (select woeid from geo.places where text='GB-LND') and u='c'"),
    locationUrl = "http://query.yahooapis.com/v1/public/yql?q=" + locationQuery + "&format=json&callback=?";

It's easier to read if you break it up. You we're pretty close, just needed the u=c as part of the query, not at the end of the url.

这篇关于雅虎天气API摄氏度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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