Page 1 of 2

RegExp error (-8)

Posted: February 4th, 2018, 12:47 pm
by rbriddickk84
Greetings everyone!

I started to making skins again, gladly i have a new job, but it eats most of my time, so i wasn't active here lately, so really sorry for that!
I tried to continue my Youtube checker skin, but i can't get my mind around this error.

Here is one site:
https://www.youtube.com/user/LAGxPeanutPwner/videos

I try to Webparse it gently with the folowing code:

Code: Select all


[Rainmeter]
Update=1000
AccurateText=1

[Variables]
upath1=LAGxPeanutPwner

[SiteCheckA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=https://www.youtube.com/user/#upath1#/videos
RegExp="(?siU)i.ytimg.com/vi/(.*)sqp.*<title>(.*)</title>"
FinishAction=[!SetVariable SorA 1][!EnableMeasureGroup "StatsA"][!Log "1A - Site checked"]
UpdateRate=582
DecodeCharacterReference=1

[SubsImageA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=[SiteCheckA]
StringIndex=1
Substitute="?":""
;Download=1
;DownloadFile=1.png
OnUpdateAction=[!UpdateMeterGroup "Deta"][!Redraw]
DynamicVariables=1
Disabled=1

[TestText1]
Meter=String
MeasureName=SubsImageA
Group=Deta
FontFace=Arial
FontColor=0,0,0
FontSize=10
StringAlign=Left
X=10
Y=100
W=380
H=40
Text=1: https://i.ytimg.com/vi/%1
DynamicVariables=1
;UpdateDivider=-1
AntiAlias=1

My issue is this; because of some strange phenomenon, at the end of the RegExp, the "<title>(.*)</title>" part is killing the plugin, i mean it returns with error (-8). I tried to search for some solution for this on other posts, i tried to understand the Lookahead Assertions but that didn't helped my problem. Or i misunderstood it, i don't know.

Here is a segment of code from the website's source as it is now:

Code: Select all


 <!-- end of chunk -->
  <script >if (window.ytcsi) {window.ytcsi.tick("pdc", null, '');}</script>
      <div id="img-preload" style="display: none;">
        <img src="//yt3.ggpht.com/dGCabgDQBmbxXyfuHxmz0wTdPY34Q62IdB3ihMYIlo32Pa2vKST7tqfoVu9XMyTic4gCmNP5Tg=w1440-fcrop64=1,32b75a57cd48a5a8-nd-c0xffffffff-rj-k-no">
        <img src="//yt3.ggpht.com/dGCabgDQBmbxXyfuHxmz0wTdPY34Q62IdB3ihMYIlo32Pa2vKST7tqfoVu9XMyTic4gCmNP5Tg=w2120-fcrop64=1,00000000ffffffff-nd-c0xffffffff-rj-k-no">
        <img src="//yt3.ggpht.com/dGCabgDQBmbxXyfuHxmz0wTdPY34Q62IdB3ihMYIlo32Pa2vKST7tqfoVu9XMyTic4gCmNP5Tg=w2560-fcrop64=1,00005a57ffffa5a8-nd-c0xffffffff-rj-k-no">
        <img src="https://yt3.ggpht.com/-giQBk7Bx-3o/AAAAAAAAAAI/AAAAAAAAAAA/RBBvZislO4E/s288-mo-c-c0xffffffff-rj-k-no/photo.jpg">
        <img src="https://i.ytimg.com/vi/FFyy7Cf5FbE/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDVLWYhlKXN5Juwliplx8Tbx4xARQ">
        <img src="https://i.ytimg.com/vi/f2K7ek4an74/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLAr-VO5KksrEfYhWjouq0KBonpvmQ">
        <img src="https://i.ytimg.com/vi/8ekDhTDKt0g/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBCZ5egw6vNCcJu54K8EKGZmAbb-w">
        <img src="https://i.ytimg.com/vi/CF66B1U6GCM/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDcb0mtvrYhwKJxjrNYNtBn6lbVAA">
        <img src="https://i.ytimg.com/vi/RiiqkTKL6BI/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBRk8I7sjkNPcrRL-oVF_FBEHYxcw">
        <img src="https://i.ytimg.com/vi/0K-AeZqJAzU/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLC-LhgmejhnalEnFhAwobDRyEAcVg">
        <img src="https://i.ytimg.com/vi/9pbkfQ4mQC8/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLD-0-GJECsnbun9d7fy7vGnVfR0Mg">
        <img src="https://i.ytimg.com/vi/pgKwmxffa58/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLClZGZdNPrDPMe2ToDXl0BhRYE3iw">
        <img src="https://i.ytimg.com/vi/ZFvGOK2QnS0/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLD3-B0aAWaJv5Wx22M6BrsqiVPTgQ">
        <img src="https://i.ytimg.com/vi/bsW1SC4NRzs/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLA2ftbvZgVKeJl72oKP4EKTCocIwg">
        <img src="https://i.ytimg.com/vi/kC8lkY33AtA/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLCHlL1L5XChTL9jaucray9MiOaJPA">
        <img src="https://i.ytimg.com/vi/SMetQQaSgwY/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBtdv4ReIEWAiOx2H_OBI7KNwzlwQ">
    </div>

    <div id="microformat">
            <title>Teo - YouTube</title>

    <link rel="canonical" href="https://www.youtube.com/channel/UCDa8HbNrmkFhKKOeiB7JaRw">

As it seems i am trying to skip all the data from the first jpg link till the <title> section, but as i found out, the "microformat" part is messing up my mind. As i tried to Index the " <div id="(.*)"> part it came out much more than just a simple text, like "microformat".
Instead tons of lines came out, and i cannot pass by that part, if i try to address lines further, it cames with error.

Am i missing something relevant, or simple here?

I appretiate all the helps!

Re: RegExp error (-8)

Posted: February 4th, 2018, 1:04 pm
by jsmorley
I'm not getting that output from the site with your parent WebParser measure.

Try setting Debug=2 on the parent measure, and see what it actually gets in WebParserDump.txt.

Re: RegExp error (-8)

Posted: February 4th, 2018, 1:11 pm
by balala
Or try the following RegExp, which uses Lookahead Assertion: RegExp=(?siU)i.ytimg.com/vi/(.*)sqp(?(?=.*<title).*>(.*)</title>).
Note that besides adding the Lookahead Assertion, I also removed the quotations around the value of the RegExp option: https://forum.rainmeter.net/viewtopic.php?p=137628#p137628

Re: RegExp error (-8)

Posted: February 4th, 2018, 1:43 pm
by rbriddickk84
Thank you both your helps! :)

I tried the Debug=2 thing, but i didn't knew where to look in the dump file or what to look for.

Jsmorley if you use this, you will get the output:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
upath1=LAGxPeanutPwner

[SiteCheckA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=https://www.youtube.com/user/#upath1#/videos
FinishAction=[!SetVariable SorA 1][!EnableMeasureGroup "StatsA"][!Log "1A - Site checked"]
RegExp=(?siU)i.ytimg.com/vi/(.*)sqp.*<div id=(.*)>
UpdateRate=582

[SubsNameA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=[SiteCheckA]
Disabled=1
OnUpdateAction=[!UpdateMeterGroup "Deta"][!Redraw]
StringIndex=2

[TestText2]
Meter=String
MeasureName=SubsNameA
Group=Deta
FontFace=Arial
FontColor=0,0,0
FontSize=8
StringAlign=Left
X=0r
Y=40r
Text=Div code: %1
DynamicVariables=1
AntiAlias=1
Balala, as i pasted your Lookahead code, the error code went gone, but still didn't displaying anything. Probably i missed something else.

Re: RegExp error (-8)

Posted: February 4th, 2018, 3:11 pm
by balala
rbriddickk84 wrote:Balala, as i pasted your Lookahead code, the error code went gone, but still didn't displaying anything. Probably i missed something else.
Don't know, it works for me:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
upath1=LAGxPeanutPwner

[SiteCheckA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=https://www.youtube.com/user/#upath1#/videos
RegExp=(?siU)i.ytimg.com/vi/(.*)sqp(?(?=.*<title).*>(.*)</title>)
;RegExp="(?siU)i.ytimg.com/vi/(.*)sqp.*<title>(.*)</title>"
FinishAction=[!SetVariable SorA 1][!EnableMeasureGroup "StatsA"][!Log "1A - Site checked"]
UpdateRate=582
DecodeCharacterReference=1

[SubsImageA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=[SiteCheckA]
StringIndex=1
Substitute="?":""
;Download=1
;DownloadFile=1.png
OnUpdateAction=[!UpdateMeterGroup "Deta"][!Redraw]
DynamicVariables=1
Disabled=1

[TestText1]
Meter=String
MeasureName=SubsImageA
Group=Deta
FontFace=Arial
FontColor=0,0,0
FontSize=10
StringAlign=Left
X=10
Y=100
W=380
H=40
Text=1: https://i.ytimg.com/vi/%1
DynamicVariables=1
;UpdateDivider=-1
AntiAlias=1
SolidColor=255,255,255
Padding=15,5,15,5
To can see better the returned string, I added two options to the end of the [TestText1] meter.

Re: RegExp error (-8)

Posted: February 4th, 2018, 3:39 pm
by rbriddickk84
Thanks Balala, i extended your code, and you will see what is my first problem:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
upath1=LAGxPeanutPwner

[SiteCheckA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=https://www.youtube.com/user/#upath1#/videos
RegExp=(?siU)i.ytimg.com/vi/(.*)sqp(?(?=.*<title).*>(.*)</title>)
;RegExp="(?siU)i.ytimg.com/vi/(.*)sqp.*<title>(.*)</title>"
FinishAction=[!SetVariable SorA 1][!EnableMeasureGroup "StatsA"][!Log "1A - Site checked"]
UpdateRate=582
DecodeCharacterReference=1

[SubsImageA]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=[SiteCheckA]
StringIndex=1
Substitute="?":""
;Download=1
;DownloadFile=1.png
OnUpdateAction=[!UpdateMeterGroup "Deta"][!Redraw]
DynamicVariables=1
Disabled=1

[SubsImageB]
Measure=Plugin
Plugin=WebParser
Group=StatsA
URL=[SiteCheckA]
StringIndex=2
DynamicVariables=1
Disabled=1

[TestText1]
Meter=String
MeasureName=SubsImageA
Group=Deta
FontFace=Arial
FontColor=0,0,0
FontSize=10
StringAlign=Left
X=10
Y=100
W=380
H=40
Text=1: https://i.ytimg.com/vi/%1
DynamicVariables=1
;UpdateDivider=-1
AntiAlias=1
SolidColor=255,255,255
Padding=15,5,15,5

[TestText2]
Meter=String
MeasureName=SubsImageB
Group=Deta
FontFace=Arial
FontColor=0,0,0
FontSize=10
StringAlign=Left
X=24
Y=25r
W=380
H=40
Text=2: %1
DynamicVariables=1
;UpdateDivider=-1
AntiAlias=1

Re: RegExp error (-8)

Posted: February 4th, 2018, 3:49 pm
by balala
rbriddickk84 wrote:Thanks Balala, i extended your code, and you will see what is my first problem:
To be honest, I don't see it. What the problem is? Because for me the [TestText1] String meter shows what the [SubsImageA] measure returned. Yeah, [TestText2] doesn't show anything, since [SubsImageB] doesn't return anything. But that's exactly why we've used the Lookahead Assertion, isn't it?

Re: RegExp error (-8)

Posted: February 4th, 2018, 3:56 pm
by rbriddickk84
Yep, there it is! :)

So was my main problem is that without the Lookahead thing i had error, i have no idea why! I just wanted to display the Title simply, but only i thought that it will be simple.
In complete, i wanted to grab the image from the site, then the Title, and after that some other data, like the video's title for the video, and etc...
But the WebParser hanged up with error at the Title part. I am trying to locate the reason of it.

Re: RegExp error (-8)

Posted: February 4th, 2018, 4:23 pm
by rbriddickk84
Okay, was there any change in the WebParser plugin lately? I was following every update, read all of them, but i don't recall that there was any modification to the webparser.
It don't work anymore as it worked when i was working with it, it was couple of updates before. Now it adresses totally different, or random things. I don't understand anymore what's happened. It should be working simple, but now it's whatever i try to do it's running in some errors, or grab some totally random code from random places.
I usually assume first that i am making the mistake, i am doing it wrong, i try so hard to figure it out where do i do wrong, but i am doing everything as i've done before many times. And it's not complicated code, it's a simple regexp code, and it don't work either.
I just don't get it. :???:

Re: RegExp error (-8)

Posted: February 4th, 2018, 4:25 pm
by balala
rbriddickk84 wrote:So was my main problem is that without the Lookahead thing i had error, i have no idea why!
Because there is no a <title>(.*)</title> part in the code of the page, after i.ytimg.com/vi/(.*)sqp. I don't know, maybe sometimes, in some circumstances there should be one, but right now there definitely isn't.
rbriddickk84 wrote:I just wanted to display the Title simply, but only i thought that it will be simple.
See above. There is nothing to display.
rbriddickk84 wrote:In complete, i wanted to grab the image from the site, then the Title, and after that some other data, like the video's title for the video, and etc...
But the WebParser hanged up with error at the Title part. I am trying to locate the reason of it.
And you don't know how to grab the image? It's not too hard, you just need a new WebParser measure, with a Download=1 option set up.