in reply to Re^2: searching with mojo dom
in thread searching with mojo dom
You might find this cleaner:
#!/usr/bin/perl use strict; use warnings; use feature 'say'; use Mojo::UserAgent; my $url = 'https://weather.com/weather/today/l/20001:4:US'; my $selector = 'div.today_nowcard-sidecar.component.panel table tr td +span'; my $ua = Mojo::UserAgent->new; say $ua->get( $url )->res->dom->at( $selector )->all_text;
However, you may want to check if their recommended API, if it offers what you want it'll be faster to access and your code more resilient to changes.
|
|---|