> Thus, at line 3067, I would do:
>
> # first try without a space...
> @matches = $tree->look_down( "_tag", "td", "class", "twc-col-2" );
>
> # if that didn't work, try WITH the space...
> if (scalar @matches == 0) {
> @matches = $tree->look_down( "_tag", "td", "class", "twc-col-2 "
> );
> }
>
> This'll at least give you a little resilience should they change the
> class ID back to the original.

We should be able to change the last argument of that look_down() call to
be a regular expression, e.g.:

@matches = $tree->look_down( "_tag", "td", "class", qr/twc-col-2 */ );

in other words, find twc-col-2 followed by 0 or more spaces.

(The third argument can also be a code-ref if you want to get really
fancy, but a regexp should be fine for weather.com's ever slightly
changing HTML.)

SBB


_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to