一 天气预报
国内的天气预报数据,主要是国家气象局和国外两个来源(指数据来源)。
国外方面主要是雅虎(XML格式,谷歌已经停掉了自家的天气API);
国内数据由国家气象局提供( *** ON格式)。
在知乎看到过一篇专业人士评论,雅虎可以提供全球范围的且非常精细的天气数据(小时级更新),但主要是通过计算机自动生成。而国家气象局则是各地经验丰富的专家人士结合计算机综合分析得出,在准确性上更胜一筹。我就这样信了!
国家气象局接口资源及用法
气象局的天气预报主页:移动版普通版 ,仔细挖掘这两个地址可以发现很多好东西哦。
特点:接口多,来自和都有,次数不限制,服务稳定,功能全面,优先推荐。
1. 实时天气接口
有多个接口,好像差别不大:
实时天气1:
实时天气2:
实时天气3(带时间戳):
2. 一周天气预报接口
7天预报数据 URL:
该接口来源气象局移动版网站,目测数据最为精确,详细接口格式如下:
{"c":{"c1":"101010100","c2":"beijing","c3":"北京","c4":"beijing","c5":"北京","c6":"beijing","c7":"北京","c8":"china","c9":"中国","c10":"1","c11":"010","c12":"100000","c13":"116.391","c14":"39.904","c15":"33","c16":"AZ9010","c17":"+8"},
"f":{"f1":
[
{"fa":"01","fb":"03","fc":"10","fd":"5","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:21|17:40"},
{"fa":"07","fb":"07","fc":"19","fd":"12","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:22|17:38"},
{"fa":"02","fb":"00","fc":"15","fd":"5","fe":"8","ff":"8","fg":"3","fh":"1","fi":"06:23|17:37"},
{"fa":"00","fb":"00","fc":"16","fd":"4","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:24|17:35"},
{"fa":"00","fb":"00","fc":"18","fd":"7","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:25|17:34"},
{"fa":"00","fb":"01","fc":"18","fd":"8","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:26|17:32"},
{"fa":"01","fb":"01","fc":"16","fd":"6","fe":"0","ff":"0","fg":"0","fh":"0","fi":"06:27|17:31"}],
"f0":"201310121100"}}
详细接口分析如下:
//格式说明
var format={fa:图片1,fb:图片2,fc:温度1,fd:温度2,fe:风向1,ff:风向2,fg:风力1,fh:风力2,fi:日出日落};
//定义天气类型
var weatherArr={"00":"晴","01":"多云","02":"阴","03":"阵雨","04":"雷阵雨","05":"雷阵雨伴有冰雹","06":"雨夹雪","07":"小雨","08":"中雨","09":"大雨","10":"暴雨","11":"大暴雨","12":"特大暴雨","13":"阵雪","14":"小雪","15":"中雪","16":"大雪","17":"暴雪","18":"雾","19":"冻雨","20":"沙尘暴","21":"小到中雨","22":"中到大雨","23":"大到暴雨","24":"暴雨到大暴雨","25":"大暴雨到特大暴雨","26":"小到中雪","27":"中到大雪","28":"大到暴雪","29":"浮尘","30":"扬沙","31":"强沙尘暴","53":"霾","99":""};
//定义风向数组
var fxArr={"0":"无持续风向","1":"东北风","2":"东风","3":"东南风","4":"南风","5":"西南风","6":"西风","7":"西北风","8":"北风","9":"旋转风"};
//定义风力数组
var flArr={"0":"微风","1":"3-4级","2":"4-5级","3":"5-6级","4":"6-7级","5":"7-8级","6":"8-9级","7":"9-10级","8":"10-11级","9":"11-12级"};
6天预报数据 URL:
该接口来源 *** ,应该是一个流传比较久的接口,大发现准确性和稳定性可能不稳定。接口分析如下:
{"weatherinfo":{
#基本信息
"city":"北京","city_en":"beijing","date_y":"2013年9月24日","date":"","week":"星期二","fchh":"11","cityid":"101010100",
#6天温度范围
"temp1":"22℃~11℃","temp2":"25℃~11℃","temp3":"26℃~13℃","temp4":"25℃~15℃","temp5":"25℃~16℃","temp6":"24℃~16℃",
#6天温度范围(华氏)
"tempF1":"71.6℉~51.8℉","tempF2":"77℉~51.8℉","tempF3":"78.8℉~55.4℉","tempF4":"77℉~59℉","tempF5":"77℉~60.8℉","tempF6":"75.2℉~60.8℉",
#6天天气
"weather1":"多云转晴","weather2":"晴","weather3":"晴","weather4":"晴转多云","weather5":"阴转阵雨","weather6":"多云",
#6天天气图示(每天2张)
"img1":"1","img2":"0","img3":"0","img4":"99","img5":"0","img6":"99","img7":"0","img8":"1","img9":"2","img10":"3","img11":"1","img12":"99",
"img_single":"1",
#6天天气图示文字(每天2)
"img_title1":"多","img_title2":"晴","img_title3":"晴","img_title4":"晴","img_title5":"晴","img_title6":"晴","img_title7":"晴","img_title8":"多云","img_title9":"阴","img_title10":"阵雨","img_title11":"多云","img_title12":"多云",
"img_title_single":"多云",
#6天风
"wind1":"北风3-4级转微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风",
"fx1":"北风","fx2":"微风",
#6天风力情况
"fl1":"3-4级转小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级",
#24小时内
"index":"较冷","index_d":"建议着大衣、呢外套加毛衣、卫衣等服装。体弱者宜着厚外套、厚毛衣。因昼夜温差较大,注意增减衣服。",
#48小时内
"index48":"较舒适","index48_d":"建议着薄外套或牛仔衫裤等服装。年老体弱者宜着夹克衫、薄毛衣等。昼夜温差较大,注意适当增减衣服。",
#紫外 洗车 旅游 舒适指数 晨练 晾晒 过敏
"index_uv":"弱",
"index48_uv":"强",
"index_xc":"适宜",
"index_tr":"适宜",
"index_co":"舒",
"st1":"21","st2":"12","st3":"24","st4":"12","st5":"25","st6":"14", #不明
"index_cl":"较适宜",
"index_ls":"适宜",
"index_ag":"极易发"
}}
直接用webservice做,将返回的数据自己做样式,,就OK了,,或者直接用插件跟简单(很多天气网站都有提供插件的)
中国国家气象局提供了获取所在城市天气预报信息接口。通过这个接口,我们就可以获取天气信息了。
关于获取天气预报的实例参考android学习手册,里面有源码。android学习手册包含9个章节,108个例子,源码文档随便看,例子都是可交互,可运行,源码采用android studio目录结构,高亮显示代码,文档都采用文档结构图显示,可以快速定位。360手机助手中下载,图标上有贝壳
中国国家气象局天气预报接口总共提供了三个:
注:上面接口2014.3.4日已不再更新。换成这个:。各位看34楼。在此感谢tdwll和黄晓佳cobish。
最详细的信息来自第三个接口。上面url中的101010100是城市代码,这里是北京的城市代码。只需要改变城市代码,就可以得到所在城市的天气信息。笔者在福州,所以选择的城市代码是福州101230101。
在浏览器上输入url:得到信息,天气信息是json的数据格式,数据如下:
{"weatherinfo":{"city":"福州","city_en":"fuzhou","date_y":"2012年5月14日","date":"","week":"星期一","fchh":"08","cityid":"101230101","temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃","tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉","weather1":"阵雨转中雨","weather2":"中雨转小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨转阵雨","weather6":"阵雨转小雨","img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3","img_title1":"阵雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"阵雨","img_title11":"阵雨","img_title12":"小雨","img_title_single":"阵雨","wind1":"微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风","fx1":"微风","fx2":"微风","fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级","index":"热","index_d":"天气较热,建议着短裙、短裤、短套装、T恤等夏季服装。年老体弱者宜着长袖衬衫和单裤。","index48":"暖","index48_d":"较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。","index_uv":"弱","index48_uv":"最弱","index_xc":"不宜","index_tr":"适宜","index_co":"较不舒适","st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18","index_cl":"较不宜","index_ls":"不太适宜","index_ag":"不易发"}}
我们可以解析json数据去得到自己想用的天气信息。
天气信息解释:
[html] view plain copy print?
{
"weatherinfo":{
!-- 基本信息 --
"city":"福州",
"city_en":"fuzhou",
"date_y":"2012年5月14日",
"date":"",
"week":"星期一",
"fchh":"08",
"cityid":"101230101",
!-- 从今天开始到第六天的每天的天气情况,这里的温度是摄氏温度 --
"temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃",
!-- 从今天开始到第六天的每天的天气情况,这里的温度是华氏温度 --
"tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉",
!-- 天气描述 --
"weather1":"阵雨转中雨","weather2":"中雨转小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨转阵雨","weather6":"阵雨转小雨",
!-- 天气描述图片序号 --
"img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3",
!-- 图片名称 --
"img_title1":"阵雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"阵雨","img_title11":"阵雨","img_title12":"小雨","img_title_single":"阵雨",
!-- 风速描述 --
"wind1":"微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风","fx1":"微风","fx2":"微风",
!-- 风速级别描述 --
"fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级",
!-- 今天穿衣指数 --
"index":"热",
"index_d":"天气较热,建议着短裙、短裤、短套装、T恤等夏季服装。年老体弱者宜着长袖衬衫和单裤。",
!-- 48小时穿衣指数 --
"index48":"暖","index48_d":"较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。",
!-- 紫外线及48小时紫外线 --
"index_uv":"弱","index48_uv":"最弱",
!-- 洗车 --
"index_xc":"不宜",
!-- 旅游 --
"index_tr":"适宜",、
!-- 舒适指数 --
"index_co":"较不舒适",
"st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18",
!-- 晨练 --
"index_cl":"较不宜",
!-- 晾晒 --
"index_ls":"不太适宜",
!-- 过敏 --
"index_ag":"不易发"
}
}
{
"weatherinfo":{
!-- 基本信息 --
"city":"福州",
"city_en":"fuzhou",
"date_y":"2012年5月14日",
"date":"",
"week":"星期一",
"fchh":"08",
"cityid":"101230101",
!-- 从今天开始到第六天的每天的天气情况,这里的温度是摄氏温度 --
"temp1":"29℃~23℃","temp2":"26℃~20℃","temp3":"24℃~20℃","temp4":"25℃~20℃","temp5":"24℃~21℃","temp6":"25℃~22℃",
!-- 从今天开始到第六天的每天的天气情况,这里的温度是华氏温度 --
"tempF1":"84.2℉~73.4℉","tempF2":"78.8℉~68℉","tempF3":"75.2℉~68℉","tempF4":"77℉~68℉","tempF5":"75.2℉~69.8℉","tempF6":"77℉~71.6℉",
!-- 天气描述 --
"weather1":"阵雨转中雨","weather2":"中雨转小雨","weather3":"小雨","weather4":"小雨","weather5":"小雨转阵雨","weather6":"阵雨转小雨",
!-- 天气描述图片序号 --
"img1":"3","img2":"8","img3":"8","img4":"7","img5":"7","img6":"99","img7":"7","img8":"99","img9":"7","img10":"3","img11":"3","img12":"7","img_single":"3",
!-- 图片名称 --
"img_title1":"阵雨","img_title2":"中雨","img_title3":"中雨","img_title4":"小雨","img_title5":"小雨","img_title6":"小雨","img_title7":"小雨","img_title8":"小雨","img_title9":"小雨","img_title10":"阵雨","img_title11":"阵雨","img_title12":"小雨","img_title_single":"阵雨",
!-- 风速描述 --
"wind1":"微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风","fx1":"微风","fx2":"微风",
!-- 风速级别描述 --
"fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级",
!-- 今天穿衣指数 --
"index":"热",
"index_d":"天气较热,建议着短裙、短裤、短套装、T恤等夏季服装。年老体弱者宜着长袖衬衫和单裤。",
!-- 48小时穿衣指数 --
"index48":"暖","index48_d":"较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。",
!-- 紫外线及48小时紫外线 --
"index_uv":"弱","index48_uv":"最弱",
!-- 洗车 --
"index_xc":"不宜",
!-- 旅游 --
"index_tr":"适宜",、
!-- 舒适指数 --
"index_co":"较不舒适",
"st1":"27","st2":"21","st3":"24","st4":"18","st5":"22","st6":"18",
!-- 晨练 --
"index_cl":"较不宜",
!-- 晾晒 --
"index_ls":"不太适宜",
!-- 过敏 --
"index_ag":"不易发"
}
}
前期的准备工作:
一、申请API(拿好appid和private_key)
二、解读《SmartWeatherAPILite WebAPI版接口使用说明书》
三、准备好areaid、type、date、appid、urlencode($key)(注意,这里经加密的key是需要encodeurl之后的才能成为接口链接的一部分)
好了下面的编码开始:
1、从附件中的areaid_list中找到你想要的地方的areaid,并且选择要查询天气的类型
NSString *areaid = @"101010100";
NSString *type =
@"index_f";
/**
* 官方文档更新的数据类型号
* 指数:index_f(基础接口);index_v(常规接口)
3天预报:forecast_f(基础接口);forecast_v(常规接口)
*
*/
2、获得当前天气date
NSDate
*_date = [NSDate date];
NSDateFormatter *dateFormatter =
[[NSDateFormatter alloc] init];
[dateFormatter
setDateFormat:@"yyyyMMddHHmmss"];//注意日期的格式
NSString *date =
[[dateFormatter stringFromDate:_date]
substringToIndex:12];//用到的精确到分,24小时制60分钟制
3、申请的appid,和private_key
NSString *appid =
@"15ds45s13a465s";//这里是楼主随便输入的,瞎编的
NSString *private_key =
@"46s4ds_SmartWeatherAPI_45s44d6";//也是瞎编的
4、算出经过urlencode后的key,这步比较重要,步骤也多,请耐心看完。
在原来的的基础上是在PHP的环境中算出的,代码如下,可在“
”下进行算法的检验
echo
urlencode(base64_encode(hash_hmac('sha1', " ;type=index_fdate=201409041509appid=15ds45s13a465s",
"46s4ds_SmartWeatherAPI_45s44d6",
TRUE)));
首先定义得到public_key和API的 *** ,还有就是对key进行encodeurl操作的 ***
注意,这里的 *** 都是被我定义在getTime的类里面,后面是在main中实例化出来的
//获得publicky
- (NSString*)
getPublicKey:(NSString*)areaid :(NSString*)type :(NSString*)date
:(NSString*)appid {
NSString *Key = [[NSString alloc]
initWithFormat:@";type=%@date=%@appid=%@",
areaid, type, [date substringToIndex:12], appid];
return
Key;
}
//获得完整的API
- (NSString*) getAPI:(NSString*)areaid
:(NSString*)type :(NSString*)date :(NSString*)appid :(NSString*)key
{
NSString *API = [[NSString alloc]
initWithFormat:@";type=%@date=%@appid=%@key=%@",
areaid, type, [date substringToIndex:12], [appid substringToIndex:6],
key];
//-------------这里需要主要的是只需要appid的前6位!!!
return
API;
}
//将获得的key进性urlencode操作
- (NSString
*)stringByEncodingURLFormat:(NSString*)_key{
NSString *encodedString
= (__bridge NSString
*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)_key,
nil, (CFStringRef) @"!$'()*+,-./:;=?@_~%#[]",
kCFStringEncodingUTF8);
//由于ARC的存在,这里的转换需要添加__bridge,原因我不明。求大神讲解
return
encodedString;
}
重点来了,在oc下的算法如下,记得把附件的Base64.h
加进来并引用到工程里面
//对publickey和privatekey进行加密
- (NSString *)
hmacSha1:(NSString*)public_key :(NSString*)private_key{
NSData*
secretData = [private_key
dataUsingEncoding:NSUTF8StringEncoding];
NSData* stringData = [public_key
dataUsingEncoding:NSUTF8StringEncoding];
const void* keyBytes =
[secretData bytes];
const void* dataBytes = [stringData
bytes];
///#define CC_SHA1_DIGEST_LENGTH 20 /* digest
length in bytes */
void* outs =
malloc(CC_SHA1_DIGEST_LENGTH);
CCHmac(kCCHmacAlgSHA1, keyBytes,
[secretData length], dataBytes, [stringData length], outs);
//
Soluion 1
NSData* signatureData = [NSData dataWithBytesNoCopy:outs
length:CC_SHA1_DIGEST_LENGTH freeWhenDone:YES];
return
[signatureData
base64EncodedString];
}
这里只是初步算出来的key,还未encodeurl,链接不能被浏览器识别,所以现在经过算法得到的_key还有一步操作才能的到真正的key。
NSString *_key = [getTime hmacSha1:[getTime
getPublicKey:areaid :type :date :appid] :private_key];
NSString *key =
[getTime
stringByEncodingURLFormat:_key];
最后一步了吧!拼接API
NSString *weatherAPI = [getTime getAPI:areaid :type :date
:appid
:key];
//OK,我们的API就可以用啦。
最后,通过API返回的值是 *** ON文件,通过解析,就能得到我们想要的数据了,下面拿一个开发的接口举例
NSDictionary *weatherDic = [getTime
getWeatherDic:@""];
// weatherDic字典中存放的数据也是字典型,从它里面通过键值取值
NSDictionary
*weatherInfo = [weatherDic
objectForKey:@"weatherinfo"];
NSLog(@"今天是 %@ %@ %@ 的天气状况是:%@ %@ -
%@",[newDateOne substringWithRange:N *** akeRange(0, 4)],[newDateOne
substringWithRange:N *** akeRange(4, 2)] ,[newDateOne
substringWithRange:N *** akeRange(6, 2)],[weatherInfo
objectForKey:@"weather"],[weatherInfo objectForKey:@"temp1"],[weatherInfo
objectForKey:@"temp2"]);
输出:2014-09-04 23:40:23.243
WeatherAPP[5688:201108] 今天是 2014-09-04 的天气状况是:晴 17℃ - 30℃
weatherInfo字典里面的内容是---{"weatherinfo":{"city":"北京","cityid":"101010100","temp1":"17℃","temp2":"30℃","weather":"晴","img1":"n0.gif","img2":"d0.gif","ptime":"18:00"}}
“”是国家气象局城市天气预报接口,其中,城市代码“101010700”代表“昌平”。以下是北京市各区县的城市代码对应说明:
101010100=北京城区
101010200=海淀
101010300=朝阳
101010400=顺义
101010500=怀柔
101010600=通州
101010700=昌平
101010800=延庆
101010900=丰台
101011000=石景山
101011100=大兴
101011200=房山
101011300=密云
101011400=门头沟
101011500=平谷
之前做过相关的App,网上搜出来的,直接粘贴了。有用请采纳哦~
国家气象局提供的天气预报接口
接口地址:
对于第三个接口,返回信息比较全面,也是以json格式提供,格式如下
{"weatherinfo": {//基本信息;"city":"北京","city_en":"beijing","date_y":"2012年2月16日", "date":"", "week":"星期四", "fchh":"11", "cityid":"101010100",//摄氏温度"temp1":"2℃~-7℃","temp2":"1℃~-7℃","temp3":"4℃~-7℃","temp4":"7℃~-5℃","temp5":"5℃~-3℃","temp6":"5℃~-2℃",//华氏温度;"tempF1":"35.6℉~19.4℉","tempF2":"33.8℉~19.4℉","tempF3":"39.2℉~19.4℉","tempF4":"44.6℉~23℉","tempF5":"41℉~26.6℉","tempF6":"41℉~28.4℉",//天气描述;"weather1":"晴","weather2":"晴","weather3":"晴","weather4":"晴转多云","weather5":"多云","weather6":"多云转阴",//天气描述图片序号"img1":"0","img2":"99","img3":"0","img4":"99","img5":"0","img6":"99","img7":"0","img8":"1","img9":"1","img10":"99","img11":"1","img12":"2","img_single":"0",//图片名称;"img_title1":"晴","img_title2":"晴","img_title3":"晴","img_title4":"晴","img_title5":"晴","img_title6":"晴","img_title7":"晴","img_title8":"多云","img_title9":"多云","img_title10":"多云","img_title11":"多云","img_title12":"阴","img_title_single":"晴",//风速描述"wind1":"北风3-4级转微风","wind2":"微风","wind3":"微风","wind4":"微风","wind5":"微风","wind6":"微风",//风速级别描述"fx1":"北风","fx2":"微风","fl1":"3-4级转小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级",//今天穿衣指数;"index":"冷","index_d":"天气冷,建议着棉衣、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣或冬大衣。",//48小时穿衣指数"index48":"冷","index48_d":"天气冷,建议着棉衣、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣或冬大衣。",//紫外线及48小时紫外线"index_uv":"弱","index48_uv":"弱",//洗车"index_xc":"适宜",//旅游"index_tr":"一般",//舒适指数"index_co":"较不舒适","st1":"1","st2":"-8","st3":"2","st4":"-4","st5":"5","st6":"-5",//晨练"index_cl":"较不宜",//晾晒"index_ls":"基本适宜",//过敏"index_ag":"极不易发"}}
全国各城市代码如下:
北京:101010100朝阳:101010300顺义:101010400怀柔:101010500通州:101010600昌平:101010700延庆:101010800丰台:101010900石景山:101011000大兴:101011100房山:101011200密云:101011300门头沟:101011400平谷:101011500八达岭:101011600佛爷顶:101011700汤河口:101011800密云上甸子:101011900斋堂:101012000霞云岭:101012100北京城区:101012200海淀:101010200天津:101030100宝坻:101030300东丽:101030400西青:101030500北辰:101030600蓟县:101031400汉沽:101030800静海:101030900津南:101031000塘沽:101031100大港:101031200武清:101030200宁河:101030700上海:101020100宝山:101020300嘉定:101020500南汇:101020600浦东:101021300青浦:101020800松江:101020900奉贤:101021000崇明:101021100徐家汇:101021200闵行:101020200金山:101020700石家庄:101090101张家口:101090301承德:101090402唐山:101090501秦皇岛:101091101沧州:101090701衡水:101090801邢台:101090901邯郸:101091001保定:101090201廊坊:101090601郑州:101180101新乡:101180301许昌:101180401平顶山:101180501信阳:101180601南阳:101180701开封:101180801洛阳:101180901商丘:101181001焦作:101181101鹤壁:101181201濮阳:101181301周口:101181401漯河:101181501驻马店:101181601三门峡:101181701济源:101181801安阳:101180201合肥:101220101芜湖:101220301淮南:101220401马鞍山:101220501安庆:101220601宿州:101220701阜阳:101220801亳州:101220901黄山:101221001滁州:101221101淮北:101221201铜陵:101221301宣城:101221401六安:101221501巢湖:101221601池州:101221701蚌埠:101220201杭州:101210101舟山:101211101湖州:101210201嘉兴:101210301金华:101210901绍兴:101210501台州:101210601温州:101210701丽水:101210801衢州:101211001宁波:101210401重庆:101040100合川:101040300南川:101040400江津:101040500万盛:101040600渝北:101040700北碚:101040800巴南:101040900长寿:101041000黔江:101041100万州天城:101041200万州龙宝:101041300涪陵:101041400开县:101041500城口:101041600云阳:101041700巫溪:101041800奉节:101041900巫山:101042000潼南:101042100垫江:101042200梁平:101042300忠县:101042400石柱:101042500大足:101042600荣昌:101042700铜梁:101042800璧山:101042900丰都:101043000武隆:101043100彭水:101043200綦江:101043300酉阳:101043400秀山:101043600沙坪坝:101043700永川:101040200福州:101230101泉州:101230501漳州:101230601龙岩:101230701晋江:101230509南平:101230901厦门:101230201宁德:101230301莆田:101230401三明:101230801兰州:101160101平凉:101160301庆阳:101160401武威:101160501金昌:101160601嘉峪关:101161401酒泉:101160801天水:101160901武都:101161001临夏:101161101合作:101161201白银:101161301定西:101160201张掖:101160701广州:101280101惠州:101280301梅州:101280401汕头:101280501深圳:101280601珠海:101280701佛山:101280800肇庆:101280901湛江:101281001江门:101281101河源:101281201清远:101281301云浮:101281401潮州:101281501东莞:101281601中山:101281701阳江:101281801揭阳:101281901茂名:101282001汕尾:101282101韶关:101280201南宁:101300101柳州:101300301来宾:101300401桂林:101300501梧州:101300601防城港:101301401贵港:101300801玉林:101300901百色:101301001钦州:101301101河池:101301201北海:101301301崇左:101300201贺州:101300701贵阳:101260101安顺:101260301都匀:101260401兴义:101260906铜仁:101260601毕节:101260701六盘水:101260801遵义:101260201凯里:101260501昆明:101290101红河:101290301文山:101290601玉溪:101290701楚雄:101290801普洱:101290901昭通:101291001临沧:101291101怒江:101291201香格里拉:101291301丽江:101291401德宏:101291501景洪:101291601大理:101290201曲靖:101290401保山:101290501呼和浩特:101080101乌海:101080301集宁:101080401通辽:101080501阿拉善左旗:101081201鄂尔多斯:101080701临河:101080801锡林浩特:101080901呼伦贝尔:101081000乌兰浩特:101081101包头:101080201赤峰:101080601南昌:101240101上饶:101240301抚州:101240401宜春:101240501鹰潭:101241101赣州:101240701景德镇:101240801萍乡:101240901新余:101241001九江:101240201吉安:101240601武汉:101200101黄冈:101200501荆州:101200801宜昌:101200901恩施:101201001十堰:101201101神农架:101201201随州:101201301荆门:101201401天门:101201501仙桃:101201601潜江:101201701襄樊:101200201鄂州:101200301孝感:101200401黄石:101200601咸宁:101200701成都:101270101自贡:101270301绵阳:101270401南充:101270501达州:101270601遂宁:101270701广安:101270801巴中:101270901泸州:101271001宜宾:101271101内江:101271201资阳:101271301乐山:101271401眉山:101271501凉山:101271601雅安:101271701甘孜:101271801阿坝:101271901德阳:101272001广元:101272101攀枝花:101270201银川:101170101中卫:101170501固原:101170401石嘴山:101170201吴忠:101170301西宁:101150101黄南:101150301海北:101150801果洛:101150501玉树:101150601海西:101150701海东:101150201海南:101150401济南:101120101潍坊:101120601临沂:101120901菏泽:101121001滨州:101121101东营:101121201威海:101121301枣庄:101121401日照:101121501莱芜:101121601聊城:101121701青岛:101120201淄博:101120301德州:101120401烟台:101120501济宁:101120701泰安:101120801西安:101110101延安:101110300榆林:101110401铜川:101111001商洛:101110601安康:101110701汉中:101110801宝鸡:101110901咸阳:101110200渭南:101110501太原:101100101临汾:101100701运城:101100801朔州:101100901忻州:101101001长治:101100501大同:101100201阳泉:101100301晋中:101100401晋城:101100601吕梁:101101100乌鲁木齐:101130101石河子:101130301昌吉:101130401吐鲁番:101130501库尔勒:101130601阿拉尔:101130701阿克苏:101130801喀什:101130901伊宁:101131001塔城:101131101哈密:101131201和田:101131301阿勒泰:101131401阿图什:101131501博乐:101131601克拉玛依:101130201 *** :101140101山南:101140301阿里:101140701昌都:101140501那曲:101140601日喀则:101140201林芝:101140401台北县:101340101高雄:101340201台中:101340401海口:101310101三亚:101310201东方:101310202临高:101310203澄迈:101310204儋州:101310205昌江:101310206白沙:101310207琼中:101310208定安:101310209屯昌:101310210琼海:101310211文昌:101310212保亭:101310214万宁:101310215陵水:101310216西沙:101310217南沙岛:101310220乐东:101310221五指山:101310222琼山:101310102长沙:101250101株洲:101250301衡阳:101250401郴州:101250501常德:101250601益阳:101250700娄底:101250801邵阳:101250901岳阳:101251001张家界:101251101怀化:101251201黔阳:101251301永州:101251401吉首:101251501湘潭:101250201南京:101190101镇江:101190301苏州:101190401南通:101190501扬州:101190601宿迁:101191301徐州:101190801淮安:101190901连云港:101191001常州:101191101泰州:101191201无锡:101190201盐城:101190701哈尔滨:101050101牡丹江:101050301佳木斯:101050401绥化:101050501黑河:101050601双鸭山:101051301伊春:101050801大庆:101050901七台河:101051002鸡西:101051101鹤岗:101051201齐齐哈尔:101050201大兴安岭:101050701长春:101060101延吉:101060301四平:101060401白山:101060901白城:101060601辽源:101060701松原:101060801吉林:101060201通化:101060501沈阳:101070101鞍山:101070301抚顺:101070401本溪:101070501丹东:101070601葫芦岛:101071401营口:101070801阜新:101070901辽阳:101071001铁岭:101071101朝阳:101071201盘锦:101071301大连:101070201锦州:101070701
1. XML接口 这个是全国天气的根节点,列出所有的省,其中的pyName字段是各个省XML的文件名,比如北京的是beijing,那就意味着北京的XML地址为 一个省的天气,其中列出该省各个市的数据,北京就列出各个区。 tmp1是更低温低,tmp2是更高温度,url非常重要,我们一会儿再说。state1和state2是神马转神马,每个数代表一个天气现象。天气现象非常多,我本想全部分析出来,后来直接放弃了这个想法。因为我看到了一个城市的天气现象的编码是26...我现在知道的有0.晴 1.多云 2.阴 6.雨夹雪 7.小雨 8.中雨 13.阵雪 14.小雪 其中后来发现知道这个没用,这个数字的主要作用是检索图片的!!!
2. 图片接口 这个图就是天气现象0(晴)的图片,其他天气现象的图片依此类推。c打头的图片是20*20像素的,b打头的是50*46像素的,d打头的是反白的图标,29*20像素,n打头的是夜间反白图标,29*20像素,注意这里的文件名是两位数字! 也许还有更多的图标,等待大家发掘啦~
3. *** ON接口 真没想到~居然有 *** ON接口~ *** ON在iPhone上分析起来要比XML简单很多 这个是北京的 *** ON数据,那个HTML的名字是根据上文XML中的url得到的。这个 *** ON中包含了实时数据、7天天气预报、气象指数等丰富的数据
获取省级代码:获取城市代码(比如安徽是22):获取区域代码(比如安庆是2206):获取到安徽省安庆市望江县的代码是220607然后去加上中国代码请求URL:就可以获取当地天气。
另外再给几个有用的探索得到的URL:天气 FLASH实况:实况FLASH:
三级选择菜单(注明,这里有四个INPUT,其中有一个被隐藏了,可用FIREFOX改下源代码查看):
实时天气(很有用哦):
1. XML接口
这个是全国天气的根节点,列出所有的省,其中的pyName字段是各个省XML的文件名,比如北京的是beijing,那就意味着北京的XML地址为
一个省的天气,其中列出该省各个市的数据,北京就列出各个区。
tmp1是更低温低,tmp2是更高温度,url非常重要,我们一会儿再说。state1和state2是神马转神马,每个数代表一个天气现 象。天气现象非常多,我本想全部分析出来,后来直接放弃了这个想法。因为我看到了一个城市的天气现象的编码是26...我现在知道的有0.晴 1.多云 2.阴 6.雨夹雪 7.小雨 8.中雨 13.阵雪 14.小雪
其中后来发现知道这个没用,这个数字的主要作用是检索图片的!!!
2. 图片接口
这个图就是天气现象0(晴)的图片,其他天气现象的图片依此类推。c打头的图片是20*20像素的,b打头的是50*46像素的,d打头的是反白的图标,29*20像素,n打头的是夜间反白图标,29*20像素,注意这里的文件名是两位数字!
3. *** ON接口
尽管苹果一直在警告侧载应用程序的危险性,并坚持对上架 App Store 的应用展开严格的审查。但由于 TestFlight 和 WebClips 这两项功能的存在,越来越多的恶意软件开发者正在积极利用这两大“官方漏洞”。比如欺诈者可忽悠 iPhone / iPad 用户侧带有恶意软件的应用程序,进...
美国联邦调查局警告食品和农业公司,要做好准备,防止勒索软件操作者在播种和收获季节攻击农业实体。联邦调查局的警告指出,以前在这些季节对6个粮食合作社的勒索软件攻击是在2021年秋收期间进行的,2022年初的两次攻击可能通过破坏种子和化肥的供应而影响种植季节。 “网络犯罪分子可能将农业合作社视为有利可...
电动汽车(EV)革命来了。在过去的十年里,插电式混合动力电动车已经从16000辆增长到超过200万辆,汽车高管们预计到2030年,超过50%的美国汽车将是全电动的。不难看出,专家们为何做出如此乐观的预测。除了不断增长的电动汽车车队,今年早些时候签署的美国国会两党基础设施协议将包括75亿美元,以帮助规...
网络安全研究人员将该 APT 组织追踪为 UNC3524,并强调在某些情况下,该组织可以对受害者环境进行超过 18 个月的访问,展示了其 “先进 “的隐匿能力。 在每一个 UNC3524 受害者环境中,攻击者都会针对一个子集的邮箱,集中其注意力在执行团队和从事企业发展、兼并和收购的员工或 IT 安...
爱尔兰一位部长表示,对爱尔兰卫生服务计算机系统的网络攻击,可能是爱尔兰遭遇的最严重的网络犯罪攻击,这次攻击直指爱尔兰国家卫生系统的核心。 攻击发生后,卫生服务部门已经暂时关闭了其IT系统以进行保护。担任公共采购和电子政务部长的Smyth先生说这是一次国际攻击,这些是网络犯罪团伙,在寻找金钱。他...
据外媒AppleInsider报道,约130万Clubhouse用户的数据被发布到了一个黑客论坛上,但iOS应用的开发者声称该平台并没有被黑客攻击,这些数据是公开的信息。发布到论坛上并公开可见的SQL数据库包括了这个基于音频的高人气社交网络用户的许多细节。约有130万用户的数据被获取并放入数据库中...