DanielPodo wrote:Huh, funnily enough, I've managed to get the temperature and description, but I can't extract the icon.
Below you can see a solution, to download the icon. I used a modified version of eclectic-tech's RegExp:
eclectic-tech wrote:RegExp;
Code: Select all
RegExp=(?siU).*data-reactid="24"><img alt=".*" height="32" title=".*" width="32" class=" " src="(.*)".*<span class="description .*" data-reactid="26">(.*)</span>.*<span class=".*" data-reactid="37">(.*)</span>
As we got used to, eclectic-tech's RegExp works well. However I removed the numeric values, because I'm not sure how they are changing over time, and I think would be better to not use those values into the RegExp:
RegExp=(?siU)data-reactid="[color=#FF0000].*[/color]"><img alt=".*" height="[color=#FF0000].*[/color]" title=".*" width="[color=#FF0000].*[/color]" class=" " src="(.*)".*<span class="description .*" data-reactid="[color=#FF0000].*[/color]">(.*)</span>.*<span class=".*" data-reactid="[color=#FF0000].*[/color]">[color=#FF0000](\d*)[/color]</span> (I marked red what I've changed over eclectic-tech's RegExp).
Using this RegExp, here is the full code to get the description, temperature and icon:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[measureWeatherParent]
Measure=WebParser
URL=https://www.yahoo.com/news/weather/
UpdateRate=1800
RegExp=(?siU)data-reactid=".*"><img alt=".*" height=".*" title=".*" width=".*" class=" " src="(.*)".*<span class="description .*" data-reactid=".*">(.*)</span>.*<span class=".*" data-reactid=".*">(\d*)</span>
FinishAction=[!EnableMeasure "measureCurrentIcon"][!CommandMeasure "measureCurrentIcon" "Update"]
[measureWeather1]
Measure=WebParser
URL=[measureWeatherParent]
StringIndex=1
[measureWeather2]
Measure=WebParser
URL=[measureWeatherParent]
StringIndex=2
[measureWeather3]
Measure=WebParser
URL=[measureWeatherParent]
StringIndex=3
[measureWeather3Celsius]
Measure=Calc
Formula=( 5 * ( measureWeather3 - 32 ) / 9 )
[measureCurrentIcon]
Measure=WebParser
Url=[&measureWeather1]
DynamicVariables=1
Download=1
Disabled=1
[meterWeatherIcon]
meter=Image
MeasureName=measureCurrentIcon
X=0
Y=0
W=50
PreserveAspectRatio=1
LeftMouseUpAction=["bingweather://"]
[meterWeatherInfo]
meter=String
MeterStyle=SmallText | BigSkinTextFormat
MeasureName=measureWeather2
MeasureName2=measureWeather3
MeasureName3=measureWeather3Celsius
X=0r
Y=0R
Padding=15,5,15,5
Text=%1#CRLF#%2 [\x0366] F (%3 [\x0366] C)
SolidColor=255,255,255,120
I added a Calc measure ([measureWeather3Celsius]) to calculate the temperature in Celsius degrees, beside Fahrenheit. If you don't need it, you can simply remove it (along with the appropriate MeasureName3 option in the [meterWeatherInfo] String meter) and modify the Text option of the same [meterWeatherInfo] meter.