Rainmeter 天气

匿名 (未验证) 提交于 2019-12-02 23:43:01

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

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

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

https://tianqi.moji.com/weather/china/fujian/xiamen

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

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

;更新系数 [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)<div class="wea_weather clearfix">.*<em>(.*)em>.*<img src="(.*)" alt.*<b>(.*)</b>.*<div class="wea_tips clearfix">.*<em>(.*)</em>.*<div class="forecast clearfix">.*明天</a>.*<img src="(.*)" alt.*<li>(.*) / (.*)</li>.*后天</a>.*<img src="(.*)" alt.*<li>(.*) / (.*)</li>  ;现在气温 [WeatherToday] Measure=WebParser Url=[Weather] StringIndex=1 DefaultValue=无 Substitute="</":"°"  ;现在天气图标 [MeasureWeathericon] Measure=WebParser Url=[Weather] StringIndex=2 Download=1 DownloadFile=1.png  ;今日天气描述 [MeasureTodayWeather] Measure=WebParser Url=[Weather] StringIndex=3 DefaultValue=无   ;今日天气提示 [MeasureTodaySuggestion] Measure=WebParser Url=[Weather] StringIndex=4 DefaultValue=无  ;---明天   ;天气图标 [MeasureToWeathericon] Measure=WebParser Url=[Weather] StringIndex=5 Download=1 DownloadFile=2.png   ;气温1 [WeatherTom1] Measure=WebParser Url=[Weather] StringIndex=7 DefaultValue=无   ;气温2 [WeatherTom2] Measure=WebParser Url=[Weather] StringIndex=6 DefaultValue=无   ;---后天   ;图标 [MeasureAftWeathericon] Measure=WebParser Url=[Weather] StringIndex=8 Download=1 DownloadFile=3.png  ;气温1 [WeatherAft1] Measure=WebParser Url=[Weather] StringIndex=10 DefaultValue=无   ;气温2 [WeatherAft2] Measure=WebParser Url=[Weather] StringIndex=9 DefaultValue=无  ;===================天气显示============    ;今日气温 [MeterTodayTemp] Meter=String DynamicVariables=1 MeasureName=WeatherToday DefaultValue=无 FontColor=255,255,255 FontSize=20 AntiAlias=1 FontFace=Comic Sans MS X=10 Y=10   ;现在天气图标 [MeterIcon] DynamicVariables=1 MeasureName=MeasureWeathericon Meter=image X=50 Y=40 H =80   ;明日天气描述图标 [MeterFutureIcon] DynamicVariables=1 MeasureName=MeasureToWeathericon Meter=image X=200 Y=40 H = 50     ;明日气温1 [MeterFutureTemp1] Meter=String DynamicVariables=1 MeasureName=WeatherTom1 FontColor=255,255,255 FontSize=14 AntiAlias=1 FontFace=Comic Sans MS X=240 Y=87   ;明日气温2 [MeterFutureTemp2] Meter=String DynamicVariables=1 MeasureName=WeatherTom2 FontColor=255,255,255 FontSize=16 AntiAlias=1 FontFace=Comic Sans MS X=180 Y=10 W = 90     ;后日天气描述图标 [MeterAfterFutureIcon] DynamicVariables=1 MeasureName=MeasureAftWeathericon Meter=image X=340 Y=40 H = 50    ;后日气温1 [MeterAfterFutureTemp1] Meter=String DynamicVariables=1 MeasureName=WeatherAft1 FontColor=255,255,255 FontSize=14 AntiAlias=1 FontFace=Comic Sans MS X=380 Y=87 W = 50  ;后日气温2 [MeterAfterFutureTemp2] Meter=String DynamicVariables=1 MeasureName=WeatherAft2 FontColor=255,255,255 FontSize=16 AntiAlias=1 FontFace=Comic Sans MS X=320 Y=10 W = 90 

  

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!