标签:
百度天气接口说明:根据经纬度/城市名查询天气的结果
百度天气接口示例:
1.http://api.map.baidu.com/telematics/v3/weather?location=北京&output=json&ak=yourkey接口参数说明:
| 参数类型 | 参数名称 | 是否必须 | 具体描述 |
|---|---|---|---|
| String | ak | true | 开发者密钥 |
| String | sn | false | 若用户所用ak的校验方式为sn校验时该参数必须。 |
| String | location | true | 输入城市名或经纬度,城市名称如:北京,经纬度格式为lng,lat坐标如: location=116.305145,39.982368;城市天气预报中间"|"分 隔,location=116.305145,39.982368| 122.305145,36.982368|…. |
| String | output | false | 输出的数据格式,默认为xml格式,当output设置为’json’时,输出的为json格式的数据; |
| String | coord_type | false | 请求参数坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02、wgs84。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。wgs84表示gps获取的坐标。 |
百度天气接口返回结果:
| 参数名称 | 含义 | 说明 | |
|---|---|---|---|
| currentCity | 当前城市 | 返回城市名 | |
| status | 返回结果状态信息 | ||
| date | 当前时间 | 年-月-日 | |
| results | 天气预报信息 | 白天可返回近期3天的天气情况(今天、明天、后天)、晚上可返回近期4天的天气情况(今天、明天、后天、大后天) | |
| results.currentCity | 当前城市 | ||
| results.weather_data | weather_data.date | 天气预报时间 | |
| weather_data.dayPictureUrl | 白天的天气预报图片url | ||
| weather_data.nightPictureUrl | 晚上的天气预报图片url | ||
| weather_data.weather | 天气状况 | 所有天气情况(”|”分隔符):晴|多云|阴|阵雨|雷阵雨|雷阵雨伴有冰雹|雨夹雪|小雨|中雨|大雨|暴雨|大暴雨|特大暴雨|阵雪|小雪| 中雪|大雪|暴雪|雾|冻雨|沙尘暴|小雨转中雨|中雨转大雨|大雨转暴雨|暴雨转大暴雨|大暴雨转特大暴雨|小雪转中雪|中雪转大雪|大雪转暴雪|浮 尘|扬沙|强沙尘暴|霾 | |
| weather_data.wind | 风力 | ||
| weather_data.temperature | 温度 | ||
百度天气接口返回xml格式的数据
01.<?xml version="1.0" encoding="utf-8"?>02.<CityWeatherResponse> 03.<status>success</status> 04.<date>2014-05-03</date> 05.<results> 06.<currentCity>北京</currentCity> 07.<weather_data> 08.<date>周六(今天, 实时:22℃)</date> 09.<dayPictureUrl>http://api.map.baidu.com/images/weather/day/leizhenyu.png<;/dayPictureUrl> 10.<nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png<;/nightPictureUrl> 11.<weather>雷阵雨转多云</weather> 12.<wind>北风5-6级</wind> 13.<temperature>24 ~ 11℃</temperature> 14.<date>周日</date> 15.<dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png<;/dayPictureUrl> 16.<nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png<;/nightPictureUrl> 17.<weather>多云转晴</weather> 18.<wind>北风4-5级</wind> 19.<temperature>19 ~ 8℃</temperature> 20.<date>周一</date> 21.<dayPictureUrl>http://api.map.baidu.com/images/weather/day/qing.png<;/dayPictureUrl> 22.<nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png<;/nightPictureUrl> 23.<weather>晴</weather> 24.<wind>微风</wind> 25.<temperature>21 ~ 9℃</temperature> 26.<date>周二</date> 27.<dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png<;/dayPictureUrl> 28.<nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png<;/nightPictureUrl> 29.<weather>多云转晴</weather> 30.<wind>微风</wind> 31.<temperature>21 ~ 10℃</temperature> 32.</weather_data> 33.</results> 34.</CityWeatherResponse>接口地址:
对于第三个接口,返回信息比较全面,也是以json格式提供,格式如下:
01.{02."weatherinfo": {03.//基本信息;"city": "北京",04."city_en": "beijing",05."date_y": "2012年2月16日",06."date": "",07."week": "星期四",08."fchh": "11",09."cityid": "101010100",10.//摄氏温度"temp1": "2℃~-7℃",11."temp2": "1℃~-7℃",12."temp3": "4℃~-7℃",13."temp4": "7℃~-5℃",14."temp5": "5℃~-3℃",15."temp6": "5℃~-2℃",16.//华氏温度;"tempF1": "35.6℉~19.4℉",17."tempF2": "33.8℉~19.4℉",18."tempF3": "39.2℉~19.4℉",19."tempF4": "44.6℉~23℉",20."tempF5": "41℉~26.6℉",21."tempF6": "41℉~28.4℉",22.//天气描述;"weather1": "晴",23."weather2": "晴",24."weather3": "晴",25."weather4": "晴转多云",26."weather5": "多云",27."weather6": "多云转阴",28.//天气描述图片序号"img1": "0",29."img2": "99",30."img3": "0",31."img4": "99",32."img5": "0",33."img6": "99",34."img7": "0",35."img8": "1",36."img9": "1",37."img10": "99",38."img11": "1",39."img12": "2",40."img_single": "0",41.//图片名称;"img_title1": "晴",42."img_title2": "晴",43."img_title3": "晴",44."img_title4": "晴",45."img_title5": "晴",46."img_title6": "晴",47."img_title7": "晴",48."img_title8": "多云",49."img_title9": "多云",50."img_title10": "多云",51."img_title11": "多云",52."img_title12": "阴",53."img_title_single": "晴",54.//风速描述"wind1": "北风3-4级转微风",55."wind2": "微风",56."wind3": "微风",57."wind4": "微风",58."wind5": "微风",59."wind6": "微风",60.//风速级别描述"fx1": "北风",61."fx2": "微风",62."fl1": "3-4级转小于3级",63."fl2": "小于3级",64."fl3": "小于3级",65."fl4": "小于3级",66."fl5": "小于3级",67."fl6": "小于3级",68.//今天穿衣指数;"index": "冷",69."index_d": "天气冷,建议着棉衣、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣或冬大衣。",70.//48小时穿衣指数"index48": "冷",71."index48_d": "天气冷,建议着棉衣、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣或冬大衣。",72.//紫外线及48小时紫外线"index_uv": "弱",73."index48_uv": "弱",74.//洗车"index_xc": "适宜",75.//旅游"index_tr": "一般",76.//舒适指数"index_co": "较不舒适",77."st1": "1",78."st2": "-8",79."st3": "2",80."st4": "-4",81."st5": "5",82."st6": "-5",83.//晨练"index_cl": "较不宜",84.//晾晒"index_ls": "基本适宜",85.//过敏"index_ag": "极不易发"86.}87.}1.http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&;day=0&city=&dfc=1&charset=utf-8接口说明:参数中city如果给了参数就是相关的城市,否则会自动判断,day=0表示今天
1.//ps:商品ID这么获取:http://item.jd.com/954086.html2.http://p.3.cn/prices/mgets?skuIds=J_商品ID&type=11.http://suggest.taobao.com/sug?code=utf-8&;q=商品关键字&callback=cb2.//ps:callback是回调函数设定
1.//ps:快递公司编码:申通="shentong" EMS="ems" 顺丰="shunfeng" 圆通="yuantong" 中通="zhongtong" 韵达="yunda" 天天="tiantian" 2.汇通="huitongkuaidi" 全峰="quanfengkuaidi" 德邦="debangwuliu" 宅急送="zhaijisong"3.http://www.kuaidi100.com/query?type=快递公司代号&postid=快递单号2.//备选参数:callback:&callback=foo就会在json外面嵌套foo({})方便做jsonp使用。 3.//备选参数:n:返回多少条记录。1.http://baike.baidu.com/api/openapi/BaikeLemmaCardApi?scope=103&;format=json&appid=379020&bk_key=关键字&bk_length=6002.//查询出错示例如下:查看原始页面 {"error_code":"20000","error_msg":"search word not found"}音乐接口1.http://kuang.xiami.com/app/nineteen/search/key/歌曲名称/diandian/1/page/歌曲当前页?_=当前毫秒&callback=getXiamiData1.http://qzone-music.qq.com/fcg-bin/cgi_playlist_xml.fcg?uin=QQ号码&json=1&g_tk=19167549341.http://qzone-music.qq.com/fcg-bin ;/fcg_music_fav_getinfo.fcg?dirinfo=0&dirid=1&uin=QQ号& p=0.519638272547262&g_tk=12842348561.http://v5.pc.duomi.com/search-ajaxsearch-searchall?kw=关键字&pi=页码&pz=每页音乐数1.http://cgi.music.soso.com/fcgi-bin/fcg_search_xmldata.q?source=10&;w=关键字&perpage=1&ie=utf-8
1.http://api.tudou.com/v3/gw?method=album.item.get&; appKey=Appkey&format=json&albumId=视频剧集ID&pageNo=当前页& pageSize=每页显示1.//参数解释: 纬度,经度 type 001 (100代表道路,010代表POI,001代表门址,111可以同时显示前三项)1.http://gc.ditu.aliyun.com/regeocoding?l=39.938133,116.395739&type=0012.//参数解释: callback是回调函数1.http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&;ip=218.4.255.255详情请参见通过ip地址准确获取对应的所在地区信息-新浪网易淘宝开放API接口调用方法
1.http://virtual.paipai.com/extinfo/GetMobileProductInfo?mobile=手机号&amount=10000&callname=getPhoneNumInfoExtCallback1.https://www.baifubao.com/callback?cmd=1059&;callback=phone&phone=手机号1.http://cz.115.com/?ct=index&;ac=get_mobile_local&callback=jsonp1333962541001&mobile=手机号1.http://www.youdao.com/smartresult-xml/search.s?jsFlag=true&;type=mobile&q=手机号1.http://api.showji.com/Locating/www.showji.com.aspx?m=手机号&output=json&callback=querycallback
1.http://v.youku.com/player/getPlayList/VideoIDS/视频ID (比如 http://v.youku.com/v_show/id_XNTQxNzc4ODg0.html的ID就是XNTQxNzc4ODg0)标签:
原文地址:http://www.cnblogs.com/mengxingxinqing/p/4401973.html