It is currently March 29th, 2024, 1:00 pm

Raptr Webparsing

Get help with creating, editing & fixing problems with skins
Lujay
Posts: 5
Joined: May 18th, 2010, 8:38 pm

Raptr Webparsing

Post by Lujay »

Hey there,

I'm new to rainmeter forums but have been using rainmeter for a while until i recently started a project which i'll later post on the forums to share with everyone, but it involves alot and is using rainmeter differently to yeah normal system monitoring :)

I was wondering if there was anything here that can help me create a RegExp to grab stuff off a website, or even link me to abit of help in creating these expressions to grab say an image and text from this site.

Code: Select all

http://raptr.com/game/360/Battlefield_Bad_Company/achievements/compare?players=MunkeyyButterr
Would be much appreciated, thanks!
User avatar
JamesAC
Developer
Posts: 318
Joined: July 14th, 2009, 5:57 pm

Re: Raptr Webparsing

Post by JamesAC »

I would recommend jsmorley's RainRegExp, available here.

That also includes a link to a very good RegExp tutorial site.

Also, you may want to look at this Webparser Tutorial.

To get an image you will have to use the newest version of Rainmeter which has the ability to download files, such as images, through webparser.

If you need any other help then we will do our best to help.
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
Lujay
Posts: 5
Joined: May 18th, 2010, 8:38 pm

Re: Raptr Webparsing

Post by Lujay »

Thank you for the quick response :D

Yeah, have been using the latest rainmeter and its worked out well so far for the things i've done.

Thank you for the program ill be sure to use it, and woops should of checked that section in the Documentation before making this post =/

Thanks again!
Lujay
Posts: 5
Joined: May 18th, 2010, 8:38 pm

Re: Raptr Webparsing

Post by Lujay »

Hello there,

Back again for some more help :P

I managed to get RainRegExp working, and have created an expression to grabbing an image off the site, but for some reason when i make StringIndex=2, it doesnt seem to work properly, it only works when i place StringIndex=1.

Is there something im doing wrong?

My current code for grabbing it and displaying is this

Code: Select all

[AchievementImage2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=4000
Url=http://raptr.com/game/360/#GameName#/achievements/compare?players=#RaptrUserName#
RegExp="(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)"
Download=1
StringIndex=2
FinishAction=!RainmeterRedraw
Debug=1

[Achievement2]
Meter=IMAGE
X=1
Y=70r
W=64
H=64
MeasureName=AchievementImage2
I just cant seem to work out why it wont pull it off (it should be grabbing the second achievement image)
User avatar
JamesAC
Developer
Posts: 318
Joined: July 14th, 2009, 5:57 pm

Re: Raptr Webparsing

Post by JamesAC »

The issue is with the way RegExp is treated in Rainmeter. While RainRegExp will return everything which matches your pattern, Rainmeter will only return one. To make it work you need to repeat the pattern for each thing you want it to return.
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
Lujay
Posts: 5
Joined: May 18th, 2010, 8:38 pm

Re: Raptr Webparsing

Post by Lujay »

So when you mean repeat the pattern, you mean have two instances of the RegExp on the same line in order to return the second?

Like

Code: Select all

RegExp="(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)""(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)"
Then use StringIndex=2?, because i tryed that then and it doesnt work still =/
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Raptr Webparsing

Post by poiru »

I think got too many quotes. Try this instead:

Code: Select all

RegExp="(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)"
Also, you could use something like this to make things easier:

Code: Select all

[Variables]
GET=(http://.{0,100}\.raptrcdn.com/activity/award_def/xbox/.{0,100}.\/.{0,100}.\/.{0,100}\.jpg).*">(.*)

[Gcal]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=blaa
RegExp="(?siU)#GET##GET##GET##GET#"

[Item1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Gcal]
StringIndex=1

[Item2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[Gcal]
StringIndex=2
Lujay
Posts: 5
Joined: May 18th, 2010, 8:38 pm

Re: Raptr Webparsing

Post by Lujay »

Thank you, that seemed to have worked, and that way of repeating each expression is so helpful i never thought of that
to use, was just imagining how long they would end up being if i had to repeat it since most games have about 45 or so
achievements each haha :P, also helps when i have to pull text off aswell for each achievement :P

Thanks !