plympton;565165 Wrote: 
> Greg,
> 
> Any way you can post your parsing methodology?  Since this seems to
> happen fairly frequently, it might be better to teach us how to fish,
> so to speak.  :-)
> 
Hey Dan-

Basically each data provider in the plugin has a 'get' and a 'got'
subroutine.  The 'get' makes a asynchronous HTTP request and the 'got'
is run when the HTML response comes back.  It then parses the HTML.  I
used to just use regular expressions to parse the response HTML line by
line, but that was pretty tedious and not very efficient.  For most
parsing I now use a HTML tree builder library that parses the HTML as a
tree that I then walk to find the data elements I need.  You can look at
the 'gotWeather' routine for an example.


Another thought - I wonder if it's possible to abstract the parsing a
bit so it's read from a config file?  Something along the lines of
skipping X characters for Y field, or skipping to XX string for Y
field?  This way we could just figure out the new format and post the
config file changes.

I'd be willing to help out getting it prototyped, but I don't want to
go through the Perl brute-force figuring out what you're doing.  You
know my love of Perl.  :-)

This has been discussed a few times in the past and I appreciate the
offer to help.  Unfortunately given the complexity of their HTML and
flexible nature of HTML I don't think there'd be an easy way to abstract
the parsing logic.

-Greg


-- 
GoCubs
------------------------------------------------------------------------
GoCubs's Profile: http://forums.slimdevices.com/member.php?userid=312
View this thread: http://forums.slimdevices.com/showthread.php?t=14327

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to