Page 3 of 3

Re: JSON Parsing

Posted: September 12th, 2017, 7:25 pm
by fonpaolo
Another interesting argument, is that they allow you to distribute your "App", if you clearly add from where the data are provided.
Nothing more or less than we do with Weather.com. ;-)

Re: JSON Parsing

Posted: September 12th, 2017, 7:26 pm
by takochako
FreeRaider wrote:Starting from your first post:

Code: Select all

RegExp=(?siU).*"currently": \{.*"temperature":(.*),.*
Anyway, I agree with jsmorley, because that A with ^ is a unicode problem.
I just tried this and it returns with "RegExp matching error (-1)" in the log.

Here's what the meters and measures look like so far:

Code: Select all

[MeasureWeatherUrl]
Measure=Plugin
Plugin=WebParser
URL=https://api.darksky.net/forecast/(removed)/(removed),(removed),(removed)
RegExp=(?siU).*"currently": {.*"temperature":(.*),.*
UpdateRate=300

[MeasureTemp]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeatherUrl]
StringIndex=1
UpdateRate=300

[MeterTemp]
Meter=String
MeasureName=MeasureTemp
FontColor=255,255,255,255
FontFace=Ubuntu
FontSize=36
Antialias=1
Text=%1 [\x00B0]

Re: JSON Parsing

Posted: September 12th, 2017, 7:33 pm
by FreeRaider

Code: Select all

(?siU).*"currently":.*\{.*"temperature":(.*),.*
Try this one.
It works for me.


P.S.: you have to use the backslash \ before { because this one is a reserved character.
RESERVED CHARACTERS:

There are a few "reserved characters" in Regular Expressions. They are:

[ \ ^ $ . | ? * + ( { }

If you use these characters in a "search" or "endsearch" component, RegExp will assume they are commands, not text, and the expression will fail. To use these characters, you must "escape" them with the "\" (backslash) character. Use "\\" to escape the "\" character itself.

Re: JSON Parsing

Posted: September 12th, 2017, 7:36 pm
by takochako
FreeRaider wrote:

Code: Select all

(?siU).*"currently":.*\{.*"temperature":(.*),.*
Try this one.
It works for me.
This one works! Thank you sooooooo much!
jsmorley wrote:One thing you might do is set Debug=2 on the parent WebParser measure and refresh the skin one time. That will give you a file WebParserDump.txt in the skin folder. Then change the URL to

URL=file://#CURRENTPATH#WebParserDump.txt

While you are designing and testing. That way you don't blow through your 1,000 free calls for the day while you are hammering it over and over to tweak the design.

When you are happy, then change the URL back.
Thanks, this is some incredibly helpful information to know when working with these sorts of things, I've got to have gone through like 600 yesterday and this morning. xD

Now the only problem that I know about is when refreshing it, I can see the degree sign, but the it disappears and is replaced with a 6. It's trying to say 67 degrees but even with changing the width it won't show the whole thing.

Re: JSON Parsing

Posted: September 29th, 2017, 11:22 pm
by fabyouless
Interrogative: Is it necessary to have the .* at the beginning and ending of the regex? Or, will this code also work?

Code: Select all

(?siU)"currently":.*"temperature":(.*),

Re: JSON Parsing

Posted: September 30th, 2017, 3:08 pm
by balala
fabyouless wrote:Interrogative: Is it necessary to have the .* at the beginning and ending of the regex? Or, will this code also work?

Code: Select all

(?siU)"currently":.*"temperature":(.*),
Have you tried your RegExp? If yes, does it work? It's easy to investigate yourself...