- UID
- 4482
- 主题
- 注册时间
- 2010-7-3
- 在线时间
- 小时
- 最后登录
- 1970-1-1
签到天数: 2 天 [LV.1]初来乍到
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?点击注册
x
这几天看到大家不断的提出天气预报出现的错误,看来这个问题还真不小。原因是天气网“http://www.weather.com.cn/data/sk/某地代码.html” 对源码的更改
现在的:
{"weatherinfo":{"city":"番禺","cityid":"101280102","temp":"15","WD":"西北风","WS":"2级","SD":"91%","WSE":"2","time":"01:50","isRadar":"0","Radar":""}}
其中,temp=当天温度 ,WD=风向 ,WS=风速 ,SD=湿度 ,WSE=?? ,time=发布时间
对应原来的天气源码的正则表达式是:
RegExp={"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","AP":"(.*)","njd":"(.*)","WSE":"(.*)","time":"(.*)","sm":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}
现在的天气源码的正则表达式是:
RegExp={"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}
大家可以发现,从红色的地方,表达式发生的变化。原来天气发布时间"time":"(.*)",的位置10现在到了8
/*********************************************************************************
两个主要Measure,直接从网页上获取所需的天气信息
[MeasureWeatherRSS] ;当天和未来几天的天气信息
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=600
Url=http://m.weather.com.cn/data/#CODE#.html
RegExp="{"weatherinfo":{"city":"(.*)","city_en":"(.*)","date_y":"(.*)","date":"(.*)","week":"(.*)","fchh":"(.*)","cityid":"(.*)","temp1":"(.*)","temp2":"(.*)","temp3":"(.*)","temp4":"(.*)","temp5":"(.*)","tempF1":"(.*)","tempF2":"(.*)","tempF3":"(.*)","tempF4":"(.*),"tempF5":"(.*)","weather1":"(.*)","weather2":"(.*)","weather3":"(.*)","weather4":"(.*)","weather5":"(.*)","img1":"(.*)","img2":"(.*)","img3":"(.*)","img4":"(.*)","img5":"(.*)","img6":"(.*)","img7":"(.*)","img8":"(.*)","img9":"(.*)","img10":"(.*)","img_single":"(.*)","img_title1":"(.*)","img_title2":"(.*)","img_title3":"(.*)","img_title4":"(.*)","img_title5":"(.*)","img_title6":"(.*)","img_title7":"(.*)","img_title8":"(.*)","img_title9":"(.*)","img_title10":"(.*)","img_title_single":"(.*)","wind1":"(.*)","wind2":"(.*)","wind3":"(.*)","wind4":"(.*)","wind5":"(.*)","fl1":"(.*)","fl2":"(.*)","fl3":"(.*)","fl4":"(.*)","fl5":"(.*)","index":"(.*)","index_d":"(.*)","index48":"(.*)","index48_d":"(.*)","index_uv":"(.*)","index48_uv":"(.*)","index_xc":"(.*)","index_tr":"(.*)","index_co":"(.*)","st1":"(.*)","st2":"(.*)","st3":"(.*)","st4":"(.*)","st5":"(.*)","st6":"(.*)"}}"
StringIndex=1
;---------------WeatherNOW----------------------
[MeasureWeatherNOW] ;当天的详细天气信息
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=100
Url=http://www.weather.com.cn/data/sk/#CODE#.html
RegExp={"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}
StringIndex=1
/**************************************************************************************************************************/
下面是获取天气发布时间的代码:
获取天气发布时间
[MeasureWeatherTime]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherNOW]
StringIndex=8 ;原来是=10,stringindex的值就是第几个(.*),天气发布时间是time后面的(.*)
;同理,获取城市名的stringIndex=1
[MeasureCity]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherRSS]
StringIndex=1
;当天温度
[MeasureWeatherTempNow]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherNOW]
StringIndex=3
;当天湿度
[MeasureWeatherSD]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherNOW]
StringIndex=6
风速(WS)对应的StringIndex=5,
风向(WD)对应的StringIndex=4,
用记事本的搜索功能找到对应的Measure改过来就可以了。注意,这些Measure下面的URL都是=[MeasureWeatherNOW],
现在的天气没有的气压(AP)等项
现在就想到这些问题,如果还有其它的问题再提出来吧 |
评分
-
查看全部评分
|