It is currently March 28th, 2024, 10:14 am

Please help a noob with the WebParser Plugin

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
grondindesigns
Posts: 3
Joined: May 14th, 2018, 4:09 pm
Location: California
Contact:

Please help a noob with the WebParser Plugin

Post by grondindesigns »

Hello,
I am trying to pull follower counts, and possibly Image, username, and description information from getwatchmaker.com user profiles.

For the example I am pulling from: http://www.getwatchmaker.com/user/S1tHW81g- ;which I hope to make an easily editable variable for pulling from various user profiles.

And using the tutorial to come up with this:

Code: Select all

[MeasureSite]
Measure=WebParser
URL=http://www.getwatchmaker.com/user/S1tHW81g-
RegExp=(?siU)<span class="follow1"></span>*<span>(.*)</span>
UpdateRate=3600

[MeasureFollowers]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1

[MeterBackground]
Meter=Image
W=320
H=64
SolidColor=20,20,20,255

[MeterFollwersLabel]
Meter=String
X=160
Y=5
W=300
H=15
FontSize=11
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
StringAlign=Center
AntiAlias=1
Text=WatchMaker Followers

[MeterFollowers]
Meter=String
MeasureName=MeasureFollowers
X=160
Y=3R
W=300
H=15
FontSize=11
FontColor=255,225,181,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
StringAlign=Center
AntiAlias=1
Ideally I would like to make a small skin like this:

Image

that pulls the information/photo in the screenshot.

Image

Any help is greatly appreciated, as I am a bit out of my element here.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Please help a noob with the WebParser Plugin

Post by balala »

grondindesigns wrote:For the example I am pulling from: http://www.getwatchmaker.com/user/S1tHW81g- ;which I hope to make an easily editable variable for pulling from various user profiles.
Without entering too deeply into this question, I assume this means that you have to log on, to access those info. Am I right?
If I am, there is no way to use the WebParser measures to access the info, because:
WebParser cannot use cookies or other session-based authentication, so it cannot be used to retrieve information from web sites requiring a login. However, Webparser can be used on sites which support HTTP authentication. E.g.
(second paragraph of the URL option of a WebParser measure help)
User avatar
grondindesigns
Posts: 3
Joined: May 14th, 2018, 4:09 pm
Location: California
Contact:

Re: Please help a noob with the WebParser Plugin

Post by grondindesigns »

balala wrote:...I assume this means that you have to log on, to access those info. Am I right?...
Thank you for the information. I checked to ensure that a login is not required to read from that information by opening the web page in a new incognito browser window. All the information in question is still view-able while not logged in. So I'm hoping that means it is still possible to pull from.
Last edited by grondindesigns on May 14th, 2018, 6:17 pm, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Please help a noob with the WebParser Plugin

Post by eclectic-tech »

grondindesigns wrote:Thank you for the information. I checked to ensure that a login is not required to read from that information by opening the web page in a new incognito browser window. All the information in question is still view-able while not logged in. So I'm hoping that means it is still possible to pull from,
The website uses scripts to set the designer image avatar (the logo you show) making unavailable to the webparser. Notice there is no link to the "src"...
<center><img id='img_avatar' src='' style='width:100%;max-width:400px;margin-top:40px;border-radius:50%;' class='z-depth-1'></center>
Scripts are used for several other functions, making all of that information unavailable. About the only items you can parse are the number of followers and some description text. :17flag
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Please help a noob with the WebParser Plugin

Post by balala »

grondindesigns wrote:I checked to ensure that a login is not required to read from that information
Yep, you're right, it's not required.
eclectic-tech wrote:The website uses scripts to set the designer image avatar (the logo you show) making unavailable to the webparser. Notice there is no link to the "src"...
Well, at least for now I succeeded downloading the image. Question is if my code will work in any circumstances. It does now for sure, but we'll see if later it also will.

Code: Select all

[Rainmeter]
Update=1000

[MeasureRainmeter]
Measure=WebParser
UpdateRate=900
Url=http://www.getwatchmaker.com/user/S1tHW81g-
RegExp=(?siU)<div style='.*'>.*<span class='.*'>(.*)</span> <span class='.*'>followers</span>.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.*<span class='.*'>(.*)</span> <span class='.*'>following</span>.*</div>.*<h3>(.*)</h3>.*<div style='.*'>(.*)</div>.*\$\("#img_avatar"\)\.attr\('src', '.*'\);.*\}\)\.attr\('src', '(.*)'\);
;RegExp=(?siU)<div style='margin-top:30px;margin-bottom:30px;text-align:center'>.*<span class='follow1'>(.*)</span> <span class='follow2'>followers</span>.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.*<span class='follow1'>(.*)</span> <span class='follow2'>following</span>.*</div>.*<h3>(.*)</h3>.*<div style='margin-top:10px;margin-bottom:8px;color:#ccc'>(.*)</div>.*\$\("#img_avatar"\)\.attr\('src', '.*'\);.*\}\)\.attr\('src', '(.*)'\);
FinishAction=[!EnableMeasure "MeasureDownloadImg"][!CommandMEasure "MeasureDownloadImg" "Update"]

[MeasureFollowers]
Measure=WebParser
Url=[MeasureRainmeter]
StringIndex=1

[MeasureFollowing]
Measure=WebParser
Url=[MeasureRainmeter]
StringIndex=2

[MeasureTitle]
Measure=WebParser
Url=[MeasureRainmeter]
StringIndex=3

[MeasureDesc]
Measure=WebParser
Url=[MeasureRainmeter]
StringIndex=4
RegExpSubstitute=1
Substitute="\n\n":"#CRLF#"

[MeasureImgURL]
Measure=WebParser
Url=[MeasureRainmeter]
StringIndex=5

[MeasureDownloadImg]
Measure=WebParser
Url=[&MeasureImgURL]
Download=1
Disabled=1
DynamicVariables=1

[MeterImg]
Meter=Image
MeasureName=MeasureDownloadImg
X=0
Y=0
W=120
H=120
PreserveAspectRatio=1

[MeterInfo]
Meter=String
MeasureName=MeasureFollowers
MeasureName2=MeasureFollowing
MeasureName3=MeasureTitle
MeasureName4=MeasureDesc
MeasureName5=MeasureImgURL
X=5R
Y=60r
W=480
H=110
ClipString=1
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=Bold
StringAlign=LEFTCENTER
AntiAlias=1
Text=%3#CRLF#%1 Followers %2 Following#CRLF#%4
InlineSetting=Size | 18
InlinePattern=^(.*)#CRLF#.*
InlineSetting2=Weight | 700
InlinePattern2=^(.*)#CRLF#.*
InlineSetting3=Size | 14
InlinePattern3=^.*#CRLF#(.*)#CRLF#.*
InlineSetting4=Weight | 400
InlinePattern4=^.*#CRLF#(.*)#CRLF#.*
Attachments
Forum.png
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Please help a noob with the WebParser Plugin

Post by eclectic-tech »

Nice solution balala :thumbup: ... I didn't see that script near the end of the code. :17readbook
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Please help a noob with the WebParser Plugin

Post by balala »

eclectic-tech wrote:Nice solution balala :thumbup: ... I didn't see that script near the end of the code. :17readbook
Don't worry, it happens many times to all of us, I think. I'm curious if the code will keep working, for longer period...
User avatar
grondindesigns
Posts: 3
Joined: May 14th, 2018, 4:09 pm
Location: California
Contact:

Re: Please help a noob with the WebParser Plugin

Post by grondindesigns »

balala wrote: Well, at least for now I succeeded downloading the image. Question is if my code will work in any circumstances. It does now for sure, but we'll see if later it also will.
Thank you for all the help. That works perfectly. :-)
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Please help a noob with the WebParser Plugin

Post by balala »

grondindesigns wrote:Thank you for all the help. That works perfectly. :-)
Yes, it did, however as I said I'm curious if it will on a longer term, too.
Post Reply