zoukankan      html  css  js  c++  java
  • 雅虎天气接口

    广州天气

        https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid=2502265%20and%20u=%22c%22&format=json
    

    雅虎天气接口

        查询时base_url:
    https://query.yahooapis.com/v1/public/yql?q= , 公共查询接口,有限制查询次数
    https://query.yahooapis.com/v1/yql?q= , 注册后获取ApkId,有限制查询次数但是已经足够使用了,10万次/天
    
    
    第一步,手机端定位用户的位置(根据IP查询,或者。。。。),得到用户所在城市名称,或者城市名称的拼音,或者经纬度
    
    第二步,根据用户所在城市的中文、英文、经纬度,获取woeid:
    
    
    1,这里text键值可以用 中文、英文、经纬度。如
    
    
    1): select * from geo.placefinder where text="Guangzhou"
    
    
    2): select * from geo.placefinder where text="北京"
    
    
    3): select * from geo.placefinder where text="39.9919336,116.3404132" and gflags = "R"
    
    
    2,使用如下url查询城市的woeid:三种方法均可使用
    https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="39.9919336,116.3404132" and gflags = "R"&format=json
    https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="北京"&format=json
    https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="Guangzhou"&format=json
    
    注意使用经纬度获取woeid时一直取不到,后来才知道时缺少一个参数 fglags参数。,必须加 and gflags = "R"这一串才行
    
    返回的xml格式的数据:
    <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2015-05-28T03:28:29Z" yahoo:lang="en-US">
    <results>
    <Result>
    <quality>40</quality>
    <latitude>23.12911</latitude>
    <longitude>113.26336</longitude>
    <offsetlat>23.12911</offsetlat>
    <offsetlon>113.26336</offsetlon>
    <radius>17700</radius>
    <name/>
    <line1/>
    <line2>Guangzhou</line2>
    <line3>Guangdong</line3>
    <line4>People's Republic of China</line4>
    <house/>
    <street/>
    <xstreet/>
    <unittype/>
    <unit/>
    <postal/>
    <neighborhood/>
    <city>Guangzhou</city>
    <county/>
    <state>Guangdong</state>
    <country>People's Republic of China</country>
    <countrycode>CN</countrycode>
    <statecode>44</statecode>
    <countycode/>
    <hash/>
    <woeid>2161838</woeid> ,这个就是需要的woeid
    <woetype>7</woetype>
    </Result>
    </results>
    </query>
    <!--  total: 11  -->
  • 相关阅读:
    Mat类具体解释(二)
    Android NDK开发篇(六):Java与原生代码通信(异常处理)
    Redis源代码剖析--对象object
    NioEventLoopGroup源码分析与线程设定
    零拷贝剖析以及用户空间与内核空间切换
    Java 字符集编码
    NIO网络编程
    NIO网络访问模式实践
    Spring Boot使用Html
    内存映射文件MappedByteBuffer和Buffer的Scattering与Gathering
  • 原文地址:https://www.cnblogs.com/jackyshan/p/5149127.html
Copyright © 2011-2022 走看看