Web scraping: Difference between revisions
Content added Content deleted
(Add an alternative Tcl solution) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: need to match on content) |
||
Line 1,355: | Line 1,355: | ||
<lang perl6>use HTTP::Client; # https://github.com/supernovus/perl6-http-client/ |
<lang perl6>use HTTP::Client; # https://github.com/supernovus/perl6-http-client/ |
||
my $site = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"; |
my $site = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"; |
||
HTTP::Client.new.get($site).match(/'<BR>'( .+? <ws> UTC )/)[0].say</lang> |
HTTP::Client.new.get($site).content.match(/'<BR>'( .+? <ws> UTC )/)[0].say</lang> |
||
Note that the string between '<' and '>' refers to regex tokens, so to match a literal '<BR>' you need to quote it, while <ws> refers to the built-in token whitespace. |
Note that the string between '<' and '>' refers to regex tokens, so to match a literal '<BR>' you need to quote it, while <ws> refers to the built-in token whitespace. |