Rainmeter 天气


http://tieba.baidu.com/p/5816309617来自百度的天气数据抓取

http://tieba.baidu.com/p/4830073469?pn=1Clock and weather  

主要是看了这两篇帖子第一个是方法来源,第二个是样式来源。

本来是用百度搜索当地天气读取,后来改为读取墨迹天气页面比如  https://tianqi.moji.com/weather/china/fujian/xiamen 为厦门市天气的页面。

如图所示,显示的图标和温度都是直接抓取网页上的。

用WebParser来抓取,具体方法第一个帖子写得很清楚了,贴一下我的代码。

具体用起来有个缺点,一个是设置为每15分钟下载一次网页源码,但是下一次15分钟后才会更新到显示(我也不知道为什么),所以刚开机时并不会正常显示,过半小时就正常了(这个具体我没有认真测,反正就是存在一定的延时,实在想快一点正常显示就rainmeter刷新两下就好了)。然后为了刷新网页缓存,翻了翻手册写了   Header=Cache-Control: no-cache  这一行代码进去,不知道有没有效,反正勉强能用就是了。

;更新系数
[Rainmeter]
Update=1500
DynamicWindowSize=1

;脚本信息
[Metadata]
Name=天气·墨迹网页
Author=EG
Version=0.1
License=Personal


;变量
[Variables]

;==============网页========================
;网页处理
[DownloadWeather]
Measure=Plugin
Plugin=WebParser
Header=Cache-Control: no-cache
Url=https://tianqi.moji.com/weather/china/fujian/siming-district
Download=1
DownloadFile=moji.html


[Weather]
Measure=Plugin
Plugin=WebParser
UpdateDivider=1
Url=file://%userprofile%\Documents\Rainmeter\Skins\illustro\Weather\DownloadFile\moji.html
RegExp=(?siU)