#!/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));