It is currently March 28th, 2024, 7:36 pm

Webparser problem ... (Solved)

Get help with creating, editing & fixing problems with skins
doomerino
Posts: 10
Joined: May 9th, 2014, 8:42 pm

Webparser problem ... (Solved)

Post by doomerino »

EDIT... GOT IT TO WORK... PROBLEM SOLVED!



Hello...

i try to regex this webside: http://herald.uthgard.net/herald.php?view=stats&p1=guild&p2=g.GuildName&p5=g.GuildName&p6=teilzeitgamer&c=Go


it's a table of top players of a guild in a online-game.. i want to parse the following parts....

Name, Realm-Rank and "LastWeekRealmPoints" of the top 5 guild-players for my skin.....

if i try to regex with the following :

Code: Select all

(?siU).*LWRP</a></td></tr>[\r\n | \n]
(.*)[\r\n | \n]<tr class="TBLalb" style=""><td align="center" style="">6</td>
i can parse the following which contain all needed infos of top 5 players:

Code: Select all

 <tr class="TBLalb" style=""><td align="center" style="">1</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Snikch">Snikch </a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=9">Infiltrator</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=4">Saracen</a></td><td style=""><div align="right">47</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=23">3L3</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">277</div></td><td style=""><div class="realmpoints" align="right">97,399</div></td><td style=""><div class="lwrp" align="right">47,394</div></td></tr>

<tr class="TBLalb" style=""><td align="center" style="">2</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Rocknrollronny">Rocknrollronny KingoftheBongo</a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=4">Minstrel</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=3">Highlander</a></td><td style=""><div align="right">47</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=22">3L2</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">420</div></td><td style=""><div class="realmpoints" align="right">94,597</div></td><td style=""><div class="lwrp" align="right">44,474</div></td></tr>

<tr class="TBLalb" style=""><td align="center" style="">3</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Zsall">Zsall </a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=6">Cleric</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=1">Briton</a></td><td style=""><div align="right">47</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=22">3L2</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">722</div></td><td style=""><div class="realmpoints" align="right">83,837</div></td><td style=""><div class="lwrp" align="right">12,216</div></td></tr>

<tr class="TBLalb" style=""><td align="center" style="">4</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Ahtan">Ahtan </a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=4">Minstrel</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=3">Highlander</a></td><td style=""><div align="right">44</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=16">2L6</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">417</div></td><td style=""><div class="realmpoints" align="right">32,745</div></td><td style=""><div class="lwrp" align="right">6,272</div></td></tr>

<tr class="TBLalb" style=""><td align="center" style="">5</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Llex">Llex </a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=1">Paladin</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=4">Saracen</a></td><td style=""><div align="right">47</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=15">2L5</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">286</div></td><td style=""><div class="realmpoints" align="right">26,015</div></td><td style=""><div class="lwrp" align="right">10,306</div></td></tr>
Now my Problem:

1. As you can see, the code contain dynamic links within the players-name. this link changes if the ranking of a player changes.

2. how can i grab the NAME , REALMRANK and LastWeekRealmPoints out of this changing code?..

for better understanding i marked the part i need with color red.. of the top 5 players
all the other links inside is not needed.. but how to parse if there is a change?
<tr class="TBLalb" style=""><td align="center" style="">5</td><td style=""><a class="charname" href="herald.php?view=stats&p1=player&p2=Player&p3=DESC&p5=Player&p6=Llex">Llex </a></td><td style=""><a class="guild" href="herald.php?view=stats&p1=guild&p2=RPs&p3=DESC&p5=Guild&p6=TeilzeitGamer">TeilzeitGamer</a></td><td style=""><a class="class1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Class&p6=1">Paladin</a></td><td style=""><a class="race1" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=Race&p6=4">Saracen</a></td><td style=""><div align="right">47</div></td><td style=""><div align="right"><a class="realmrank" href="herald.php?view=stats&p1=player&p2=RPs&p3=DESC&p5=RR&p6=15">2L5</a></div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">0</div></td><td style=""><div class="kills" align="right">286</div></td><td style=""><div class="realmpoints" align="right">26,015</div></td><td style=""><div class="lwrp" align="right">10,306</div></td></tr>
thank you for any advice or tips..
tried this for days ... :sly:

regards
doomerino
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser problem ... (Solved)

Post by balala »

Have you figured out how to do? Because a solved icon appeared...
If you didn't, here is a first workaround:

Code: Select all

[Rainmeter]
DynamicWindowSize=1

[Variables]
Item=.*<a class="charname".*>(.*)</a>.*<a class="realmrank".*>(.*)</a>.*<div class="realmpoints".*>(.*)</div>

[MeasureParent]
Measure=WebParser
Url=http://herald.uthgard.net/herald.php?view=stats&p1=guild&p2=g.GuildName&p5=g.GuildName&p6=teilzeitgamer&c=Go
RegExp=(?siU)#Item##Item##Item##Item##Item#
;RegExp=(?siU)=""><a class="charname".*>(.*)</a>
UpdateRate=#UpdateRateSeconds#

[MeasureCharname1]
Measure=WebParser
Url=[MeasureParent]
StringIndex=1

[MeasureRealmmark1]
Measure=WebParser
Url=[MeasureParent]
StringIndex=2

[MeasureRealmpoint1]
Measure=WebParser
Url=[MeasureParent]
StringIndex=3

[MeasureCharname2]
Measure=WebParser
Url=[MeasureParent]
StringIndex=4

[MeasureRealmmark2]
Measure=WebParser
Url=[MeasureParent]
StringIndex=5

[MeasureRealmpoint2]
Measure=WebParser
Url=[MeasureParent]
StringIndex=6

[MeasureCharname3]
Measure=WebParser
Url=[MeasureParent]
StringIndex=7

[MeasureRealmmark3]
Measure=WebParser
Url=[MeasureParent]
StringIndex=8

[MeasureRealmpoint3]
Measure=WebParser
Url=[MeasureParent]
StringIndex=9

[MeasureCharname4]
Measure=WebParser
Url=[MeasureParent]
StringIndex=10

[MeasureRealmmark4]
Measure=WebParser
Url=[MeasureParent]
StringIndex=11

[MeasureRealmpoint4]
Measure=WebParser
Url=[MeasureParent]
StringIndex=12

[MeasureCharname5]
Measure=WebParser
Url=[MeasureParent]
StringIndex=13

[MeasureRealmmark5]
Measure=WebParser
Url=[MeasureParent]
StringIndex=14

[MeasureRealmpoint5]
Measure=WebParser
Url=[MeasureParent]
StringIndex=15

[MeterString]
MeasureName=MeasureCharname1
MeasureName2=MeasureRealmmark1
MeasureName3=MeasureRealmpoint1
MeasureName4=MeasureCharname2
MeasureName5=MeasureRealmmark2
MeasureName6=MeasureRealmpoint2
MeasureName7=MeasureCharname3
MeasureName8=MeasureRealmmark3
MeasureName9=MeasureRealmpoint3
MeasureName10=MeasureCharname4
MeasureName11=MeasureRealmmark4
MeasureName12=MeasureRealmpoint4
MeasureName13=MeasureCharname5
MeasureName14=MeasureRealmmark5
MeasureName15=MeasureRealmpoint5
Meter=String
X=0
Y=0
Padding=15,5,15,5
StringAlign=Left
FontFace=Tahoma
FontSize=8
FontColor=220,220,220
SolidColor=0,0,0,150
AntiAlias=1
Text=1. %1 / %2 / %3#CRLF#2. %4 / %5 / %6#CRLF#3. %7 / %8 / %9#CRLF#4. %10 / %11 / %12#CRLF#5. %13 / %14 / %15
This code is as simple as I can be. Please first test it and let me know how does it work. Because if it does, it can be improved, eg making it to use Lookahead Assertion.
doomerino
Posts: 10
Joined: May 9th, 2014, 8:42 pm

Re: Webparser problem ... (Solved)

Post by doomerino »

hey...

i allready solved the problem, but really thank you for your reply. your code work for me as well.....
and looks for me more cleaner than mine^^..

thanks a lot.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser problem ... (Solved)

Post by balala »

You're welcome.