ngoomie 4d5e0c7883 Better handling of language wildcards
English (langcode `en`) no longer needs to be specified alongside the wildcard; `generate.pl` now handles wildcard langcodes properly and will add both the plain URL for English and the wildcard URL to match every other language
2023-07-05 23:20:43 -06:00

26 lines
629 B
Perl
Executable File

#!/bin/env perl
use warnings;
use strict;
use utf8;
use YAML::Syck;
use File::Slurp;
use Sort::Key::Natural qw(natsort);
my $data = LoadFile('list.yml');
my @list;
foreach my $wiki ( keys %{$data} ) {
foreach my $lang ( @{%{$data}{$wiki}} ) {
if ($lang eq 'en') {
push @list, "*://" . $wiki . ".fandom.com/wiki/*\n"
} elsif ($lang eq '*') {
push @list, "*://" . $wiki . ".fandom.com/wiki/*\n";
push @list, "*://" . $wiki . ".fandom.com/*/wiki/*\n"
} else {
push @list, "*://" . $wiki . ".fandom.com/" . $lang . "/wiki/*\n"
}
}
}
write_file('ublacklist-fandom.txt', natsort(@list));