• 雅虎天气接口


    广州天气

        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  -->
  • 相关阅读:
    Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 错误解决
    linux打包压缩的时候如何剔除某些不想打包的进来的文件
    linux修改时区和时间
    Linux scp远程文件/目录传输
    nginx报错”could not build the server_names_hash”
    配置Linux+Apache+Mysql+PHP环境
    PHP运行出现Notice : Use of undefined constant 的完美解决方案
    Silverlight 资源文件的问题 不能按指定语言切换
    Silverlight 应用 WCF RIA Services 在 IIS6 部署问题总结
    构架之累
  • 原文地址:https://www.cnblogs.com/jackyshan/p/5149127.html
Copyright © 2020-2023  润新知