It is currently December 12th, 2018, 4:06 am

RainRegExp - Rainmeter Regular Expression tester

Share your custom plugins and applications to enhance Rainmeter.
User avatar
jsmorley
Developer
Posts: 18476
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRegExp - Rainmeter Regular Expression tester

jsmorley » January 27th, 2015, 11:53 am

moshi wrote:just noted: the help section of the app says:
\l does not work with Rainmeter.
maybe this part of the help section should be removed as it is misleading. on the other hand nobody ever reported this in all these years.
Huh... Will do. Thanks. While it is pointless to try and "teach regular expressions" in the context of that little help panel, I really should re-work that to be more helpful.
ms310
Posts: 77
Joined: April 1st, 2015, 7:16 am

Re: RainRegExp - Rainmeter Regular Expression tester

ms310 » August 17th, 2015, 5:59 am

Hi - I am sure this is not a problem with this tool, but i am having trouble getting it to connect to the following website: http://isitraining.in/nagoya

It works in any browser but I get a "cannot connect" in the tool.

Any idea why this may be?

Thanks!
User avatar
jsmorley
Developer
Posts: 18476
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRegExp - Rainmeter Regular Expression tester

jsmorley » August 17th, 2015, 10:47 am

ms310 wrote:Hi - I am sure this is not a problem with this tool, but i am having trouble getting it to connect to the following website: http://isitraining.in/nagoya

It works in any browser but I get a "cannot connect" in the tool.

Any idea why this may be?

Thanks!
The site is detecting the browser type, so it can use the proper formatting for different types of browsers. (and no doubt so it can collect information for advertisers) Since it doesn't recognize RainRegExp (or Rainmeter/WebParser either), it is redirecting you to an error condition. As of right now, you can't parse that site.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /nagoya
on this server.</p>
<p>Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
We may look at adding an optional "UserAgentString" to the WebParser measure, so instead of it using the default:

Rainmeter WebParser Plugin

You might set it to:

UserAgentString=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36

Or whatever user agent you like. A user can get one that they know works by going to the site in their browser, and assuming that works ok, get their user agent string from http://whatsmyuseragent.com/. Let us chew on this a bit. My only hesitation is that if a web site is restricting access to actual browsers, so they can stick advertising in your face, it's a bit shady to have Rainmeter defeat that intent. Everybody is entitled to eat.
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: RainRegExp - Rainmeter Regular Expression tester

moshi » August 17th, 2015, 4:05 pm

this usually works:

Code: Select all

[MeasureCover1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=600
Url="http://isitraining.in/nagoya"
Debug=1
Download=1
DownloadFile="site.html"
FinishAction=[!SetOption MeasureCover3 Url "file://[MeasureCover1]" "#CURRENTCONFIG#"][!EnableMeasure MeasureCover3][!CommandMeasure MeasureCover3 Update][!UpdateMeasure MeasureCover3]

[MeasureCover3]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateDivider=-1
Url=""
RegExp="(?siU).*<h1 class='result'>(.*)</h1>"
Debug=1
StringIndex=1
i am schizophrenic about this. although i just posted a workaround, i still think content providers should have a chance to exclude Rainmeter if they want to.
User avatar
jsmorley
Developer
Posts: 18476
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRegExp - Rainmeter Regular Expression tester

jsmorley » August 17th, 2015, 4:14 pm

moshi wrote:i am schizophrenic about this. although i just posted a workaround, i still think content providers should have a chance to exclude Rainmeter if they want to.
I am also of two minds on this. I think if I were a purist about it, I'd have to go uninstall the AdBlocker plugin from my Google Chrome, and I have no intention of doing that. Still, more than likely the site is checking for a browser so it can at least attempt to serve ads to you, or to collect information for Google Analytics or some other revenue-generating purpose, and while this would be purely "opt-in" and up to the end-user, I'm not sure Rainmeter should actively support a way to defeat that. The site is more or less saying "if you don't want the ads, you don't get the information". That isn't entirely unreasonable.

However, it's far from black-and-white. In one sense the entire purpose of WebParser, the reason it even exists, is to get information from web sites without having to go to them in your browser. So by its very nature WebParser is already avoiding all the revenue-generating stuff the site might well intend you to see or provide. Again, if we are going to be purist about it, then we should fix WebParser so it will only work with an RSS/ATOM feed, and can't be used to "screen-scrape" a site at all.

I guess at the end of the day, as long as Google has AdBlocker Plus in the Google Play store, their position is that it is not the job of the "tool", but the "user" to decide how they want to play this game. I'm sorta ok with Rainmeter having the same outlook.
ms310
Posts: 77
Joined: April 1st, 2015, 7:16 am

Re: RainRegExp - Rainmeter Regular Expression tester

ms310 » August 18th, 2015, 1:57 am

Thank you both for the detailed information on what is happening and a workaround.
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: RainRegExp - Rainmeter Regular Expression tester

moshi » August 18th, 2015, 8:56 pm

jsmorley wrote:I guess at the end of the day, as long as Google has AdBlocker Plus in the Google Play store, their position is that it is not the job of the "tool", but the "user" to decide how they want to play this game.
their position rather is: let's use this adblocking thing as a viral marketing tool until we dominate this market. ;)

on Android i had to get my adblocker (Adguard) from the Yandex.Store. it is nowhere to be found in the Play Store.
this might change though when iOS 9 comes this fall:
http://appleinsider.com/articles/15/06/10/apple-enables-third-party-content-blockers-for-safari-in-ios-9
User avatar
Virginityrocks
Posts: 494
Joined: February 26th, 2011, 10:22 pm

Re: RainRegExp - Rainmeter Regular Expression tester

Virginityrocks » April 6th, 2018, 5:41 am

So many addons I wish I knew about sooner. Thanks again, Js!