It is currently April 27th, 2024, 12:13 pm

Verse of the Day

Get help with creating, editing & fixing problems with skins
armaninyow
Posts: 8
Joined: April 15th, 2022, 3:26 pm

Verse of the Day

Post by armaninyow »

Hi. I need help with getting the text or string from the site https://www.verseoftheday.com/ , specifically the verse and the book.

Image

It's been almost two years since my last experience with rainmeter and I totally forgot everything about it. I'm looking at the webparser tutorial but can't seem to understand almost everything in it. It says to get the <span> part of the code but I don't see any in the webparserdumb.text I got from the debugging. I don't know anything about coding but I think I can probably manage the font styles. :D

I hope somebody will notice. Thanks!
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Verse of the Day

Post by RicardoTM »

You don't need to look for any <span>, you need to look into the html code and look what's around what you are looking for. If you are using chrome, just right click on any website then "view page source" or Ctrl+U. If you look at the code you'll find what you are looking for, in this case:
Captura de pantalla 2024-02-26 062753.jpg
So, what you need is what's between <meta property="og:description" content=" and "/>

<meta property="og:description" content="As the body without the spirit is dead, so faith without deeds is dead."/>

So your code would be:

Code: Select all

[MeasureSite]
Measure=WebParser
URL=https://www.verseoftheday.com/
RegExp=(?siU)<meta property="og:description" content="(.*)"/>

[MeasureVerse]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1
You do not have the required permissions to view the files attached to this post.
armaninyow
Posts: 8
Joined: April 15th, 2022, 3:26 pm

Re: Verse of the Day

Post by armaninyow »

RicardoTM wrote: February 26th, 2024, 12:32 pm You don't need to look for any <span>, you need to look into the html code and look what's around what you are looking for. If you are using chrome, just right click on any website then "view page source" or Ctrl+U. If you look at the code you'll find what you are looking for, in this case:
Captura de pantalla 2024-02-26 062753.jpg

So, what you need is what's between <meta property="og:description" content=" and "/>

<meta property="og:description" content="As the body without the spirit is dead, so faith without deeds is dead."/>

So your code would be:

Code: Select all

[MeasureSite]
Measure=WebParser
URL=https://www.verseoftheday.com/
RegExp=(?siU)<meta property="og:description" content="(.*)"/>

[MeasureVerse]
Measure=WebParser
URL=[MeasureSite]
StringIndex=1
Hi! Unfortunately, I can't test your code right now as I am away from home. But I really appreciate you responding quickly! I will try this tomorrow as soon as possible. Thank you!
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Verse of the Day

Post by RicardoTM »

armaninyow wrote: February 26th, 2024, 12:48 pm Hi! Unfortunately, I can't test your code right now as I am away from home. But I really appreciate you responding quickly! I will try this tomorrow as soon as possible. Thank you!
No problem, by the way, if you also want the "-James2:26", the you need to look for that first, and then the verse, and have 2 child measures:

Code: Select all

[MeasureSite]
Measure=WebParser
URL=https://www.verseoftheday.com/
RegExp=(?siU)<meta property="og:title" content="(.*)"/>.*<meta property="og:description" content="(.*)"/>

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

[MeasureDescription]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2
Each (.*) is an StringIndex
And each part is separated by .*

RegExp=(?siU)<meta property="og:title" content="(.*)"/>.*<meta property="og:description" content="(.*)"/>
armaninyow
Posts: 8
Joined: April 15th, 2022, 3:26 pm

Re: Verse of the Day

Post by armaninyow »

RicardoTM wrote: February 26th, 2024, 1:02 pm No problem, by the way, if you also want the "-James2:26", the you need to look for that first, and then the verse, and have 2 child measures:

Code: Select all

[MeasureSite]
Measure=WebParser
URL=https://www.verseoftheday.com/
RegExp=(?siU)<meta property="og:title" content="(.*)"/>.*<meta property="og:description" content="(.*)"/>

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

[MeasureDescription]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2
Each (.*) is an StringIndex
And each part is separated by .*

RegExp=(?siU)<meta property="og:title" content="(.*)"/>.*<meta property="og:description" content="(.*)"/>
Hi! Your code works and I've made a few adjustments:

Image

And here's the code now:

Code: Select all

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

[MeasureSite]
Measure=WebParser
URL=https://www.verseoftheday.com/
RegExp=(?siU)<meta property="og:title" content="(.*)"/>.*<meta property="og:description" content="(.*)"/>

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

[MeasureVerse]
Measure=WebParser
URL=[MeasureSite]
StringIndex=2
RegExpSubstitute=1
Substitute="&#34;":'"'

[MeterBook]
Meter=String
MeasureName=MeasureBook
X=500
Y=0
W=480
FontColor=255,255,255,255
FontSize=12
FontFace=Cardo
FontWeight=600
StringEffect=Shadow
FontEffectColor=0,0,0,255
Padding=0,10,10,0
Clipstring=2
AntiAlias=1
StringAlign=RightTop
InlineSetting=Shadow | 1 | 1 | 5 | 0,0,0,255
InlinePattern=

[MeterVerse]
Meter=String
MeasureName=MeasureVerse
X=500
Y=0R
W=480
H=1040
FontColor=255,255,255,255
FontSize=12
FontFace=Cardo
FontWeight=600
StringEffect=Shadow
FontEffectColor=0,0,0,255
Padding=0,10,10,0
;SolidColor=0,0,0,255
StringAlign=RightTop
Clipstring=2
AntiAlias=1
InlineSetting=Shadow | 1 | 1 | 5 | 0,0,0,255
InlinePattern=
But the thing is, I want to keep the "Verse of the Day:" above and the "Daniel 2:27-28" under the verse, so basically another meter(?)

So how do I remove the Daniel part at the top then put it under without including the Verse of the day? I'm confused with this part because they are part of one string according to the webparser.

Thank you!
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Verse of the Day

Post by Yincognito »

armaninyow wrote: February 27th, 2024, 10:12 amBut the thing is, I want to keep the "Verse of the Day:" above and the "Daniel 2:27-28" under the verse, so basically another meter(?)

So how do I remove the Daniel part at the top then put it under without including the Verse of the day? I'm confused with this part because they are part of one string according to the webparser.
It doesn't matter if it's a single string, most of the times you can adjust it as desired, by adding a proper Substitute (with or without RegExpSubstitute, depending on what you need) to the appropriate measure. In this case, you'd probably want to do this in your MeasureBook measure by adding a newline at the right place in the string. I'll let RicardoTM detail this, if by any chance you have difficulties in doing it yourself.

P.S. The result will keep being a single string, with the effects obvious when it comes to the mouse actions on the associated meter (e.g. clicking, etc). Breaking the string to multiple measures (and displaying the results in the associated meters) is typically needed only if you want to do different things when it comes to the mouse actions on the meters, or position various parts of the string in more flexible locations in the skin (e.g. not necessarily under one another, etc).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Verse of the Day

Post by RicardoTM »

armaninyow wrote: February 27th, 2024, 10:12 am I want to keep the "Verse of the Day:" above and the "Daniel 2:27-28" under the verse, so basically another meter(?)

Thank you!
As Yin already mentioned, you don't need more meters, you can reference multiple measures and separate them using #CRLF# on a single meter.

First we'll get rid of "Verse of the Day:" directly on [MeasureSite] by adding it to the RegExp. As you can probably tell by looking at the HTML code, it is included on the html string, so we need to include it on the measure to get rid of it:
Replace RegExp on [MeasureSite] with
RegExp=(?siU)<meta property="og:title" content="Verse of the Day:(.*)"/>.*<meta property="og:description" content="(.*)"/>

As you can see, I only added what's in blue.

Then, delete [MeterVerse], you don't really need it as you can use multiple "MeasureNames" on a single Meter. So now let's add another MeasureName to [MeterBook]

MeasureName2=MeasureVerse

Now, we can reference the values of both measures using "%1 and %2". To do that we just add a Text option to [MeterBook], where we include the missing "Verse of the Day:" and "-". Like this:

Text=Verse of the Day:#CRLF#%2#CRLF#-%1

And that's it. Now it should be displayed as you want it.

You can space the lines by adding more #CRLF#.

I put first %2 and then %1 because %2 is the verse (MeasureName2) and %1 is the book (MeasureName).
Captura de pantalla 2024-02-27 052705.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Verse of the Day

Post by Yincognito »

RicardoTM wrote: February 27th, 2024, 11:21 am As Yin already mentioned, you don't need more meters, you can reference multiple measures and separate them using #CRLF# on a single meter.
Actually, I slightly misunderstood what the OP wanted - luckily you paid more attention to it. I thought he wanted "Daniel..." right under "Verse...", but reading your answer I realized that he wanted the former to be after the verse's content, and not after the "Verse..." phrase. It surely makes more sense the way you put it. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Verse of the Day

Post by RicardoTM »

Yincognito wrote: February 27th, 2024, 8:58 pm Actually, I slightly misunderstood what the OP wanted - luckily you paid more attention to it. I thought he wanted "Daniel..." right under "Verse...", but reading your answer I realized that he wanted the former to be after the verse's content, and not after the "Verse..." phrase. It surely makes more sense the way you put it. :thumbup:
Yup, I noticed that. I knew since my first answer he would want to do that, but let him try to figure it out himself. The truth is that some things are not that obvious. Although in this case he wanting to do that was indeed obvious :lol:
armaninyow
Posts: 8
Joined: April 15th, 2022, 3:26 pm

Re: Verse of the Day

Post by armaninyow »

Yincognito wrote: February 27th, 2024, 8:58 pm Actually, I slightly misunderstood what the OP wanted - luckily you paid more attention to it. I thought he wanted "Daniel..." right under "Verse...", but reading your answer I realized that he wanted the former to be after the verse's content, and not after the "Verse..." phrase. It surely makes more sense the way you put it. :thumbup:
Hi @Yincognito! I'm sorry for the misunderstanding, I should have been more detailed. Yes... I wanted the "Daniel..." to be placed after the verse's content. Thanks for your help :D