Created
June 14, 2019 08:36
-
-
Save JRaspass/293df8e791cef4774ee107689c3e5e22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use Cro::HTTP::Client; | |
| my @langs = ( | |
| 'Julia', | |
| 'https://julialang.org/downloads/', | |
| /"stable release: v"(.+?)"<"/, | |
| 'Perl', | |
| 'https://www.perl.org', | |
| /'"version-highlight">'(.+?)"<"/, | |
| 'PHP', | |
| 'https://www.php.net/downloads.php', | |
| /"Stable</span>"\s*"PHP "(\S+)/, | |
| 'Python', | |
| 'https://www.python.org', | |
| /"Latest: <".+?">Python "(.+?)"<"/, | |
| 'Ruby', | |
| 'https://www.ruby-lang.org/en/downloads/', | |
| /"stable version is "(\S+)"."/, | |
| ); | |
| my $len = @langs[0, 3 … *]».chars.max; | |
| for @langs -> $lang, $url, $re { | |
| state $client = Cro::HTTP::Client.new(:!follow :http<1.1>); | |
| my $res = await $client.get($url); | |
| printf "%*s %s\n", $len, $lang, (await $res.body) ~~ $re ?? ~$0 !! Nil; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment