Skip to content

Commit

Permalink
Fix latest-langs after templating about versions
Browse files Browse the repository at this point in the history
  • Loading branch information
JRaspass committed Jul 11, 2020
1 parent 825f8e6 commit c4fb62d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions latest-langs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ constant @langs = (
constant $len = @langs[0, 3*.chars.max;

my %current = (get('https://code.golf/about') ~~ m:g/
'<tr><th' .+? '>' (.+?) '<' .*? (<[\d+.]> ** 2..*)
(<-[>]>+?) \s+ '<td>' .*? (<[\d+.]> ** 2..*)
/)».list.flat».Str.Hash;

for @langs -> $lang, $url, $re {
Expand All @@ -87,5 +87,8 @@ for @langs -> $lang, $url, $re {
sub get ($url) {
state $client = Cro::HTTP::Client.new(:!follow :http<1.1>);

await (await $client.get($url)).body;
my $html = await (await $client.get($url)).body;

# Decode HTML entities.
$html.subst: / '&#' (\d+) ';' /, { chr $0 }, :g;
}

0 comments on commit c4fb62d

Please sign in to comment.