It is currently May 6th, 2024, 1:27 pm

WebParse problem extracting info

Get help with creating, editing & fixing problems with skins
johanni
Posts: 6
Joined: July 19th, 2012, 2:52 am

WebParse problem extracting info

Post by johanni »

Hello everybody,
I have following problem and would appreciate your help. I am playing around with the WebParser Plugin and am trying to get information from websites.
I tried to extract the title of following website but it does not work, all it shows is my "output".
What am I doing wrong?

Many thanks in advance

[MeasureTest]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
Url="http://www.wikipedia.org/"
RegExp="(?siU)<title>(.*)</title>.*"
StringIndex=1

Code: Select all

[MeterTest]
MeasureName=MeasureTest
Meter=STRING
X=2
Y=2
FontColor=0,0,0,255
FontSize=12
StringAlign=LEFT
FontFace=Tahoma
Antialias=1
Prefix="Output "
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParse problem extracting info

Post by jsmorley »

You need to add

DynamicWindowSize=1

To the [Rainmeter] section of your skin, as that meter is not sitting on any background meter or anything, so it starts out as just "Output:" before the WebParser measure gets the information, and does not grow to include the new information unless the window size of the skin is dynamic. Other than that it works fine, and the information you are asking for is being returned.
johanni
Posts: 6
Joined: July 19th, 2012, 2:52 am

Re: WebParse problem extracting info

Post by johanni »

hah - excellent

many thanks!
johanni
Posts: 6
Joined: July 19th, 2012, 2:52 am

Re: WebParse problem extracting info

Post by johanni »

@ jsmorley

Thanks your your help, would have one more question though.
Why does it not work in below case? If I ask for the copy right content it works but when I want to get a price as below, it doesn't.

any idea?

Code: Select all

[Rainmeter]
DynamicWindowSize=1

;[WEBSITE MEASURES]===============================

[MeasureTest]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
Url="http://www.bunkerworld.com/prices/"
RegExp="(?siU)<a href="/prices/port/sg/sin/?grade=IFO380">(.*)</a>.*"
StringIndex=1


;[DISPLAY METERS]==================================

[MeterTest]
MeasureName=MeasureTest
Meter=STRING
X=2
Y=2
FontColor=0,0,0,255
FontSize=12
StringAlign=LEFT
FontFace=Tahoma
Antialias=1
Prefix="Output "
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParse problem extracting info

Post by jsmorley »

(?siU)<a href="/prices/port/nl/rtm/\?grade=IFO380">(.*)</a>.*

The "?" char is a "reserved character" in Regular Expressions, so if you want to include it as a literal in a search you need to "escape" it with the "\" character as above.
johanni
Posts: 6
Joined: July 19th, 2012, 2:52 am

Re: WebParse problem extracting info

Post by johanni »

What a legend!
Many thanks!