# 解决国内天气预报更新出现的问题 - Rainmeter技术教程 - 雨滴社区 - Powered by Discuz!
 找回密码
 点击注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 26343|回复: 73

[其它] 解决国内天气预报更新出现的问题

[复制链接]

签到天数: 2 天

[LV.1]初来乍到

发表于 2011-3-13 02:52:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?点击注册

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)等项

现在就想到这些问题,如果还有其它的问题再提出来吧

评分

参与人数 1活跃值 +10 收起 理由
欢少 + 10 精品文章

查看全部评分

回复

使用道具 举报

签到天数: 108 天

[LV.6]常住居民II

发表于 2011-3-13 07:15:35 | 显示全部楼层
多谢楼主。我的天气又完好可用了。
回复

使用道具 举报

该用户从未签到

发表于 2011-3-13 10:04:31 | 显示全部楼层
受教了…………
回复

使用道具 举报

签到天数: 9 天

[LV.3]偶尔看看II

发表于 2011-3-13 17:57:45 | 显示全部楼层
完全没明白,后来改的字都挤一起了。。。
回复

使用道具 举报

签到天数: 38 天

[LV.5]常住居民I

发表于 2011-3-14 18:38:33 | 显示全部楼层
回帖留作记号,,,问题解决了,感谢楼主
回复

使用道具 举报

该用户从未签到

发表于 2011-3-15 22:55:00 | 显示全部楼层
不行啊 乱套了
回复

使用道具 举报

签到天数: 18 天

[LV.4]偶尔看看III

发表于 2011-3-18 22:05:07 | 显示全部楼层
谢谢哈。。。又ok了
回复

使用道具 举报

该用户从未签到

发表于 2011-3-21 09:21:08 | 显示全部楼层
正在头痛这个问题,看了LZ的解答,帮助太大了。谢谢!
顺手把自己改好的ini发一份上来。(TOKEN的套装天气)

Weather.rar

3.87 KB, 下载次数: 284, 下载积分: 活跃值 -1 点

回复

使用道具 举报

该用户从未签到

发表于 2011-3-23 22:44:44 | 显示全部楼层
十分
感谢
回复

使用道具 举报

该用户从未签到

发表于 2011-3-23 22:45:07 | 显示全部楼层
十分
感谢@@wohaoku
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点击注册

本版积分规则

快速回复 返回顶部 返回列表