I seem to be having problems with a Regexp command in one of my skins, that was working up until recently, and think I've found the answer, but not a way to fix it.
FYI, I'm using the RC of 2.1, and will upgrade to the release version shortly, but suspect that this will not change anything too drastically.
So, on to debugging, and 'About' Rainmeter shows a matching error (-1). Without any obvious changes to the page in question, I used the RainRegExp program to try to highlight the errors and, to my surprise, only about 10% of the page source appeared in the top window.
It appears to stop at the exact point where a special character appears in the page source - a black diamond with a white question mark in it - which I have since learned is termed a 'replacement glyph'. Guessing that this is the cause of the entire issue, is there any way around it? Putting Debug=2 in the skin presented me with a complete copy of the page source in c:\webparserdump.txt, but importing it into RainRegExp from the text file results in the same 90% being chopped from the file.
I don't need the character, so is there any way to tell the webparser to just ignore this character (assuming it IS the culprit) and parse the rest of the file?
Sorry if this has been answered before, but could not find anything in search.
Thanks
It is currently May 6th, 2024, 11:00 am
Webparser and Special Characters
-
- Posts: 5
- Joined: September 19th, 2011, 1:37 pm
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Webparser and Special Characters
Can you post a link to the site you are hitting and your RegExp so I can take a look at what is going on?
-
- Posts: 5
- Joined: September 19th, 2011, 1:37 pm
Re: Webparser and Special Characters
The page is http://www.trueachievements.com/Chameleon1977.htm and the regexp statement is : -
RegExp="(?i)(>Chameleon1977</a>[0-9]+(,[0-9]+)*)"
For quick reference, RainRegExp screenshot here: http://i55.tinypic.com/noaloz.jpg
and page source from Firefox here: http://i52.tinypic.com/t071ah.jpg
Edit: Not the prettiest RegExp, I'm sure. But it worked until recently
RegExp="(?i)(>Chameleon1977</a>[0-9]+(,[0-9]+)*)"
For quick reference, RainRegExp screenshot here: http://i55.tinypic.com/noaloz.jpg
and page source from Firefox here: http://i52.tinypic.com/t071ah.jpg
Edit: Not the prettiest RegExp, I'm sure. But it worked until recently
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Webparser and Special Characters
I have no idea why RainRegExp hates whatever character is being sent as that ? code. It might be the AutoIt "InetGet" function as much as it is my code itself.
You can cheat though. Go to the website in your browser. Then right click and "view source". copy the output in that window and just paste it into RainRegExp rather than "connecting" to the website.
You can cheat though. Go to the website in your browser. Then right click and "view source". copy the output in that window and just paste it into RainRegExp rather than "connecting" to the website.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 5
- Joined: September 19th, 2011, 1:37 pm
Re: Webparser and Special Characters
Yes, but the error is not just RainRegExp - it's being replicated in Rainmeter itself, which is what promted me to debug in RainRegExp in the first place.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Webparser and Special Characters
You might try CodePage=1200 on your Webparser measure. That should set WebParser to support UCS-2 Little Endian, which might work.
-
- Posts: 5
- Joined: September 19th, 2011, 1:37 pm
Re: Webparser and Special Characters
Thanks, but still not working.
FYI, the full code for the skin is below (clearly based initially on someone else's work, but the Trueachievements stuff is mine).
FYI, nxe.png and talogo.png are local files; the two measures I'm having problems with are MeasureTAScore and MeasureCompletion. Also attached is the image of how it used to look.
FYI, the full code for the skin is below (clearly based initially on someone else's work, but the Trueachievements stuff is mine).
FYI, nxe.png and talogo.png are local files; the two measures I'm having problems with are MeasureTAScore and MeasureCompletion. Also attached is the image of how it used to look.
Code: Select all
[Rainmeter]
Author=AshJ
AppVersion=1.0
Update=1000
Blur=1
BlurRegion=2,10,68,390,262,10
;Modified by Chameleon
;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin
[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=
;End of added Metadata
[Variables]
FontColor=255, 255, 255, 235
FontHeight=11
FontName=AvantGarde-Book Bold
gamertag=Chameleon1977
;Note: Gamertag is case sensitive on TrueAchievements.com
;--------------------------------------------
[AvatarImage]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://avatar.xboxlive.com/avatar/#gamertag#/avatar-body.png
Download=1
FinishAction=!RainmeterRedraw
[MeasureGamerScore]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/#gamertag#.card
RegExp="(>[0-9]{1,9})"
Substitute=">":""
[MeasureTAScore]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
CodePage=1200
Debug=2
Url=http://www.trueachievements.com/#gamertag#.htm
RegExp="(?i)(>#gamertag#</a>[0-9]+(,[0-9]+)*)"
Substitute=">#gamertag#</a>":"TA Score:",",":""
[MeasureCompletion]
Measure=Plugin
Plugin=Plugins\WebParser.dll
CodePage=1200
UpdateRate=1800
Url=http://www.trueachievements.com/#gamertag#.htm
RegExp="(?i)(Percentage: [0-9][0-9].[0-9][0-9]%)"
Substitute="Percentage: ":"","%":"% Complete"
;--------------------------------------------
[CardBackground]
Meter=IMAGE
Y=60
ImageName=NXE.png
[Avatar]
Meter=IMAGE
X=250
Y=0
W=150
H=300
AntiAlias=1
MeasureName=AvatarImage
[GamerTag]
Meter=STRING
X=15
Y=80
W=245
H=60
FontColor=#FontColor#
FontFace=#FontName#
FontSize=20
StringStyle=BOLD
AntiAlias=1
Text=#gamertag#
ToolTipText=Xbox.com
LeftMouseDownAction=!execute ["http://live.xbox.com/en-GB/default.aspx"]
[GamerScore]
Meter=STRING
MeasureName=MeasureGamerScore
X=22
Y=33r
W=100
H=60
Prefix="GamerScore:"
FontColor=#FontColor#
FontFace=#FontName#
FontSize=15
AntiAlias=1
[TA]
Meter=Image
x=25
y=187
w=64
h=64
imagename=talogo.png
AntiAlias=1
ToolTipText=TrueAchievements.com
LeftMouseDownAction=!execute
["http://www.trueachievements.com/#gamertag#.htm"]
[TAScore]
Meter=STRING
MeasureName=MeasureTAScore
X=69r
Y=11r
W=180
H=40
FontColor=#FontColor#
FontFace=#FontName#
FontSize=15
StringAlign=Left
StringStyle=NORMAL
AntiAlias=1
ClipString=1
ToolTipText=TrueAchievements.com
LeftMouseDownAction=!execute
["http://www.trueachievements.com/#gamertag#.htm"]
[Completion]
Meter=STRING
MeasureName=MeasureCompletion
X=3r
Y=19r
W=200
H=20
FontColor=#FontColor#
FontFace=#FontName#
FontSize=12
StringAlign=Left
StringStyle=NORMAL
AntiAlias=1
ClipString=1
;---------------------------------
[RecentAchievementsImage]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/en-US/#gamertag#.card
RegExp="(?s)(http://tiles\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles
\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles\.xbox\.com/tiles/.*?
\.jpg).*?(http://tiles\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles
\.xbox\.com/tiles/.*?\.jpg)"
StringIndex=1
Download=1
FinishAction=!RainmeterRedraw
[RecentAchievements]
Meter=IMAGE
X=25
Y=145
W=32
H=32
MeasureName=RecentAchievementsImage
[RecentAchievementsImage2]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/en-US/#gamertag#.card
RegExp="(?s)(http://tiles\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles
\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles\.xbox\.com/tiles/.*?
\.jpg).*?(http://tiles\.xbox\.com/tiles/.*?\.jpg).*?(http://tiles
\.xbox\.com/tiles/.*?\.jpg)"
StringIndex=2
Download=1
FinishAction=!RainmeterRedraw
[RecentAchievements2]
Meter=IMAGE
X=5R
Y=0r
W=32
H=32
MeasureName=RecentAchievementsImage2
[RecentAchievementsImage3]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/en-US/#gamertag#.card
RegExp="(?s)(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg).*(http://tiles\.xbox\.com/tiles/.*?
\.jpg).*(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg)"
Download=1
StringIndex=3
FinishAction=!RainmeterRedraw
[RecentAchievements3]
Meter=IMAGE
X=5R
Y=0r
W=32
H=32
MeasureName=RecentAchievementsImage3
[RecentAchievementsImage4]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/en-US/#gamertag#.card
RegExp="(?s)(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg).*(http://tiles\.xbox\.com/tiles/.*?
\.jpg).*(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg)"
Download=1
StringIndex=4
FinishAction=!RainmeterRedraw
[RecentAchievements4]
Meter=IMAGE
X=5R
Y=0r
W=32
H=32
MeasureName=RecentAchievementsImage4
[RecentAchievementsImage5]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://gamercard.xbox.com/en-US/#gamertag#.card
RegExp="(?s)(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg).*(http://tiles\.xbox\.com/tiles/.*?
\.jpg).*(http://tiles\.xbox\.com/tiles/.*?\.jpg).*(http://tiles
\.xbox\.com/tiles/.*?\.jpg)"
Download=1
StringIndex=5
FinishAction=!RainmeterRedraw
[RecentAchievements5]
Meter=IMAGE
X=5R
Y=0r
W=32
H=32
MeasureName=RecentAchievementsImage5
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Webparser and Special Characters
Well, I am stumped. It's not just Rainmeter or RainRegExp that hates it when it hits that code, it is pretty much everything. When I bring it into Notepad++, I get <div id="divSkin"> then a NULL character, then it carries on. If I leave it as ANSI, It can be viewed like that, but the output in HTML is encoded as <META http-equiv="Content-Type" content="text/html; charset=utf-16"> and when I convert to that (it is the same as UTF-2 Little Endian in Notepad++) then the file just truncates as soon as it hits that NULL. It literally just throws the rest away. That is what WebParser and AutoIt are doing as well...
I'm not sure where to go from here. I suppose you might just dump the file to a local text file using Debug=2 and Debug2File, then open the file using a Lua script and see if you can replace the offending stuff with something else like spaces, then save the file and read it with WebParser using file:// instead of http://, but not sure even that would work.
Oh, as a side note, you have messed up your RegExp statements on those measures getting the images. Somehow they have been "wrapped" with linefeeds, and that will not work. You need to put them back so that the entire RegExp= statement is on one line.
I wish I had a better answer. A couple of other guys are looking at it to see if I missed something, so check back in a bit.
I'm not sure where to go from here. I suppose you might just dump the file to a local text file using Debug=2 and Debug2File, then open the file using a Lua script and see if you can replace the offending stuff with something else like spaces, then save the file and read it with WebParser using file:// instead of http://, but not sure even that would work.
Oh, as a side note, you have messed up your RegExp statements on those measures getting the images. Somehow they have been "wrapped" with linefeeds, and that will not work. You need to put them back so that the entire RegExp= statement is on one line.
I wish I had a better answer. A couple of other guys are looking at it to see if I missed something, so check back in a bit.
-
- Developer
- Posts: 2872
- Joined: April 17th, 2009, 12:18 pm
Re: Webparser and Special Characters
Could you download webparser.zip, extract, and copy the correct version of WebParser.dll (32bit/64bit depending on your version of Rainmeter) into your Plugins folder (usually Program Files\Rainmeter\Plugins). Let me know if that fixes it.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Webparser and Special Characters
Chameleon77, looks like you might just win the "Found a bug" award this month...poiru wrote:Could you download webparser.zip, extract, and copy the correct version of WebParser.dll (32bit/64bit depending on your version of Rainmeter) into your Plugins folder (usually Program Files\Rainmeter\Plugins). Let me know if that fixes it.
Be sure you fix this in your skin as well:
Oh, as a side note, you have messed up your RegExp statements on those measures getting the images. Somehow they have been "wrapped" with linefeeds, and that will not work. You need to put them back so that the entire RegExp= statement is on one line.