Unable to load image

Perl script to grab all Marsey's off of this website and make it Pleroma friendly

use strict;
use warnings;
use experimental 'smartmatch';

use Data::Dumper;
use JSON::XS;
use LWP::UserAgent;
use HTTP::Request;
my $json = JSON::XS->new->utf8->allow_nonref;
my $request = HTTP::Request->new(GET => 'https://rdrama.net/marsey_list.json');
my $ua = LWP::UserAgent->new;
$ua->agent("Mozillacels stay losing");

my $response = $ua->request($request);
die "Failed to fetch" unless defined $response;

sub contents_to_file($$)
{
        my ($filename, $content) = @_;
        open(my $fh, '>', $filename) or die "Couldn't open file $filename: $!";
        print $fh $$content;
        close $fh;
}

# Get emojis
my $emojos = $json->decode($response->content);
my %pack = (
        'files' => {},
        # empty?
        pack => {},
        files_count => 0,
);

# Case sensitive: 'Marsey', 'Misc', 'Wojak', 'Classic', 'Tay', 'Wolf', 'Marsey Alphabet', 'Platy', 'Marsey Flags', 'Rage', 'Flags', 'Sets'
my @categories = ('Marsey');

foreach my $emojo (@{$emojos})
{
        if ($emojo->{class} ~~ @categories)
        {
                $pack{'files'}->{$emojo->{name}} = $emojo->{name} . '.webp';
        }
}

$pack{files_count} = keys %{$pack{files}};

my $output = $json->encode(\%pack);
# Write content to file
contents_to_file 'pack.json', \$output;

I wrote it because I setup an Apache Reverse Proxy where I created a "fake" emoji-pack, where all the requests where Pleroma expects them just redirect to /e/{emojiname}.webp here :#marsey57:

Just felt like sharing, incase any of you want to read Perl

It allows me to steal emojis here without manually submitting them all like I was before.

22
Jump in the discussion.

No email address required.

Seeing perl code bring in a JSON library is something, like a boomer riding a skateboard

Jump in the discussion.

No email address required.

You've clearly never written json using C, writing in Perl feels super nice, like it's done in Python

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.