It is currently April 20th, 2024, 11:44 am

Weather code

Get help with creating, editing & fixing problems with skins
Setsuna22
Posts: 2
Joined: February 1st, 2023, 6:49 am

Weather code

Post by Setsuna22 »

Hello can someone help me to analyze this code?

Code: Select all

[Variables]
CODE=136010101

FontColor=0,0,0,120
EffectColor=0,0,0,30

[M1]
Meter=Image
Imagename=Weather.png
x=0
y=-10


[MeasureWeatherRSS]
Measure=Plugin
Plugin=Plugins\WebParser
Url=//m.weather.com.cn/data/#CODE#.html
RegExp="{"weatherinfo":{"city":"(.*)","city_en":"(.*)","date_y":"(.*)","date":"(.*)","week":"(.*)","fchh":"(.*)","cityid":"(.*)","temp1":"(.*)","temp2":"(.*)","temp3":"(.*)","temp4":"(.*)","weather1":"(.*)","weather2":"(.*)","weather3":"(.*)","weather4":"(.*)","img1":"(.*)","img2":"(.*)","img3":"(.*)","img4":"(.*)","img5":"(.*)","img6":"(.*)","img7":"(.*)","img8":"(.*)","img_single":"(.*)","img_title1":"(.*)","img_title2":"(.*)","img_title3":"(.*)","img_title4":"(.*)","img_title5":"(.*)","img_title6":"(.*)","img_title7":"(.*)","img_title8":"(.*)","img_title_single":"(.*)","wind1":"(.*)","wind2":"(.*)","wind3":"(.*)","wind4":"(.*)","fl1":"(.*)","fl2":"(.*)","fl3":"(.*)","fl4":"(.*)","index":"(.*)","index_d":"(.*)","index48":"(.*)","index48_d":"(.*)","index_uv":"(.*)","index48_uv":"(.*)","index_xc":"(.*)","index_tr":"(.*)","index_co":"(.*)"}}"
StringIndex=1

[MeasureWeatherNOW]
Measure=Plugin
Plugin=Plugins\WebParser
UpdateRate=20000
Url=http://www.weather.com.cn/data/sk/#CODE#.html
RegExp={"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}} 
StringIndex=1

[MeasureTempNOW]
Measure=Plugin
Plugin=Plugins\WebParser
Url=[MeasureWeatherNOW]
StringIndex=3

[MeasureWeatherIcon]
Measure=Plugin
Plugin=Plugins\WebParser
Url=[MeasureWeatherRSS]
StringIndex=16

[MeasureCity]
Measure=Plugin
Plugin=Plugins\WebParser
Url=[MeasureWeatherRSS]
StringIndex=2
Substitute="":"CITY"



;================================================================  Measure


[MeterIcon]
MeasureName=MeasureWeatherIcon
Meter=IMAGE
ImageTint=0,0,0
X=26
Y=6
W=110
H=103
LeftMouseDownAction=!Execute [!RainmeterRedraw]["http://www.weather.com.cn/weather/136010101.shtml"]

[MeterTemp]
MeasureName=MeasureTempNOW
Meter=STRING
X=55
Y=80
FontColor=#FontColor#
FontSize=13
StringAlign=center
FontEffectColor=#EffectColor#
StringAlign=right
FontFace=Spy Agency
Antialias=1


[MeterDerc]
MeasureName=MeasureCity
Meter=STRING
StringCase=Upper
X=135
Y=46
H=130
W=60
FontSize=17
FontColor=#FontColor#
StringAlign=center
FontEffectColor=#EffectColor#
FontFace=Nes Controller
Antialias=1
angle=-0.97
LeftMouseDownAction=!Execute [!RainmeterRedraw]["http://www.weather.com.cn/weather/101240903.shtml"]

;==============================================================Temp And City And Image
the result is not showing on my skin, thank you!
Last edited by balala on February 1st, 2023, 4:22 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting codes. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather code

Post by balala »

Setsuna22 wrote: February 1st, 2023, 6:56 am Hello can someone help me to analyze this code?
Unfortunately there is not too much to analyze, because the provided URLs are wrong. Both of them:
  • //m.weather.com.cn/data/#CODE#.html I assume this URL is truncated. Its beginning is missing. Accordingly the [MeasureWeatherRSS] measure returns an error in the log, which says that the used URL doesn't use a recognized protocol. This is why I said the beginning of the address is missing (some https: or something similar).
  • http://www.weather.com.cn/data/sk/#CODE#.html - This URL (used into the [MeasureWeatherNOW] measure) is more or less correct (well, rather less than more), at least it can be accessed into a web browser, however it seems to give an error. but being a Chinese site, I'm not sure at all.
So, for first you should try fixing the URLs. In fact I assume there should be used one single URL, but finally it's completely up to you how many do you use. However they should be correct, otherwise you can't get the skin working.
Setsuna22
Posts: 2
Joined: February 1st, 2023, 6:49 am

Re: Weather code

Post by Setsuna22 »

Hello i tried your suggestion but still not working, ill try to find another solutions! Thank you!!!
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather code

Post by balala »

Setsuna22 wrote: February 2nd, 2023, 8:48 am Hello i tried your suggestion but still not working, ill try to find another solutions!
In fact I had no suggestion, so there were nothing to try. Just said your URLs are wrong. Not even a web browser doesn't return anything, so Rainmeter definitely can't return the needed data. Check those URLs if you want to get the skin working.