It is currently April 24th, 2024, 11:15 pm

Facebook and Rainmeter

Get help with creating, editing & fixing problems with skins
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Facebook and Rainmeter

Post by PtitChat107 »

Hello,
Avid to be able to follow the progress of some pages on Facebook; I wished to create a skin to be able to get back the variable containing the number of "like" on the page. Unfortunately that has to work that for a few days and I does not understand why. :/
[measureFacebook]
Measure=Plugin
Plugin=WebParser
Url=https://www.facebook.com/BFMTV/likes
UpdateRate=300
StringIndex=1
RegExp="(?siU)<div class="_50f6 _50f7 _5tfx">(.*)</div>"
Substitute="":"..."

[meterValueFacebook]
Meter=String
MeterStyle=styleRightText
MeasureName=measureFacebook
StringIndex=1
X=200
Y=100
W=190
H=14
LeftMouseUpAction=!Execute ["https://www.facebook.com/BFMTV/likes"]
Text=%1likes
Normally can import the used url, the skin must be always able to work.
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Facebook and Rainmeter

Post by PtitChat107 »

dvo wrote:

Code: Select all

(?siU)<meta name="description" content="BFMTV(.*)v
for only the likes
It seems to work but it also shows me special characters and piece of sentence. Would have it no simpler solution how what there what I was able to find at first ? I want to retrieve only the number of likes.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Facebook and Rainmeter

Post by FreeRaider »

I suggest this code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[MeasureFacebook]
Measure=Plugin
Plugin=WebParser
Url=https://www.facebook.com/BFMTV/likes
UpdateRate=300
RegExp=(?siU).*\["PagesLikesTab",.*elem_.*\}.*\],(.*)\],\[\]\],
FinishAction=[!EnableMeasure MeasureLikes][!UpdateMeasure MeasureLikes][!ShowMeter MeterValueFacebook]

[MeasureLikes]
Measure=Plugin
Plugin=WebParser
URL=[MeasureFacebook]
StringIndex=1
Substitute="":"..."
Disabled=1

[MeterValueFacebook]
Meter=String
MeasureName=MeasureLikes
X=10
Y=10
W=190
H=100
FontColor=220,220,220
FontSize=15
FontFace=Calibri
StringStyle=BOLD
LeftMouseUpAction=["https://www.facebook.com/BFMTV/likes"]
Text=%1 likes
AntiAlias=1
Hidden=1

edit: correct the (?siU) repetition.
Last edited by FreeRaider on August 8th, 2016, 8:08 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Facebook and Rainmeter

Post by balala »

FreeRaider wrote:I suggest this code:
FreeRaider, although it's not causing troubles, you've used twice the (?siU) in the RegExp option of the
[MeasureFacebook] measure. Replace this option with: RegExp=(?siU).*\["PagesLikesTab",.*elem_.*\}.*\],(.*)\],\[\]\],, to remove one of them.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Facebook and Rainmeter

Post by FreeRaider »

balala my oversight.

Thanks for having seen that occurrence.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Facebook and Rainmeter

Post by balala »

Don't worry FreeRaider, it happens to me, too, many times.
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Facebook and Rainmeter

Post by PtitChat107 »

balala wrote:Replace this option with: RegExp=(?siU).*\["PagesLikesTab",.*elem_.*\}.*\],(.*)\],\[\]\],, to remove one of them.
Thanks to you two it works perfectly, it remains for me to find the same manipulation for a youtube channel and the number of subscribers and it will be perfect !

Edit.: As against it would not be possible to insert a space between each of the three numbers ?
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Facebook and Rainmeter

Post by FreeRaider »

PtitChat107 wrote:Thanks to you two it works perfectly, it remains for me to find the same manipulation for a youtube channel and the number of subscribers and it will be perfect !

Edit.: As against it would not be possible to insert a space between each of the three numbers ?
Glad to help
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Facebook and Rainmeter

Post by balala »

PtitChat107 wrote:Thanks to you two it works perfectly,
I don't think I deserve any "thank". It was FreeRaider's work.
PtitChat107 wrote:Edit.: As against it would not be possible to insert a space between each of the three numbers ?
Which three numbers? If I'm not wrong, you'd like to get the shown number as 1 000 000, instead of 1000000. Am I right? If I have, you'll have to replace the existing Substitute option of the [MeasureLikes] measure, with the followings:

Code: Select all

[MeasureLikes]
Measure=Plugin
...
RegExpSubstitute=1
Substitute="^$":"...","^(\d{1,3})(\d{3})(\d{3})$":"\1 \2 \3"
(don't forget to not just add these options, but remove the existing Substitute option - Substitute="":"...").
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Facebook and Rainmeter

Post by FreeRaider »

balala, a note: if the number is not composed of 7 digits, it does not make the substitution.

I think it's better to use a lua script.