It is currently April 18th, 2024, 11:06 pm

WebParser taking all the line?

Get help with creating, editing & fixing problems with skins
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

WebParser taking all the line?

Post by Zaragan »

I'm having troubles with parsing a web (https://api.warframestat.us/pc/cetusCycle) and when i do

Code: Select all

RegExp=(?siU)"isDay":(.*),
it takes all the line (https://i.imgur.com/PpLsiCC.png)("isDay":true,) not only the info i want. Is anyone experiencing something like that? I know it's not a problem of the webpage because when i use the RainRegExp tool it works fine (https://i.imgur.com/rkcdtcF.png)


If the skin is not showing to you it's because the "Background", change it and it will work.

Code: Select all

; Lines starting ; (semicolons) are commented out.
; That is, they do not affect the code and are here for demonstration purposes only.
; ----------------------------------

; NOTE! If you want to add more disks, take a look at 'Disks 2.ini'.

[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=1000
Background=#@#\Images\Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
; Contains basic information of the skin.
Name=Disk
Author=poiru
Information=Displays disk usage.
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------
[measureApi]
Measure=Plugin
Plugin=WebParser.dll
Url=https://api.warframestat.us/pc/cetusCycle
UpdateRate=1000
RegExp=(?siU)"isDay":(.*),
; Substitute="true":"Dia","false":"Noche"

; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=Test
; Even though the text is set to Disk, Rainmeter will display
; it as DISK, because styleTitle contains StringCase=Upper.

[meterCycle]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text="Ciclo"

[meterCycleValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureApi
X=200
Y=0r
W=300
H=14
Thank you!!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser taking all the line?

Post by jsmorley »

You need StringIndex=1 on the WebParser measure.

What that measure is saying is:

Get this from the website: "isDay":(.*),
And put what is matched by (.*) in the first (capture), or StringIndex 1.

StringIndex 0, the default, is just the entire thing, and of no use except to the measure itself. StringIndex 0 is the text that all the (captures) use to create the specific StringIndex numbers that point to the specifically matched data elements.

So if I have:

RegExp=<item>(.*)</item>.*<item>(.*)</item>

Then what is created is StringIndex 0, which will have something like:

<item>boat</item> <item>airplane</item>

And the regular expression will put boat in StringIndex 1, the first (capture) and airplane in StringIndex 2, the second (capture). Then I would use two child measures to turn those StringIndex numbers into specific text values, that I would use in my String meters.
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

Re: WebParser taking all the line?

Post by Zaragan »

f--- me. :17angry So easy... Did you heard about the debugging duck? I think im gonna buy one tomorrow

:17good Thank you!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser taking all the line?

Post by jsmorley »

Zaragan wrote:f--- me. :17angry So easy... Did you heard about the debugging duck? I think im gonna buy one tomorrow

:17good Thank you!
Glad to help.