#!/usr/bin/env perl
    
use strict;
use warnings;

use Data::Rmap qw(:all);
use Path::Class;
use JSON::MaybeXS;

my $section = "/science/organic-chemistry/";

my $data = decode_json( file('topics.json')->slurp );
my @videos = rmap_hash {
	my $path = $_->{path} // '';
	my $kind = $_->{kind} // '';
	if( $path =~ m,^\Q$section\E, && $kind eq 'Video' ) {
		my $data = $_;
		my $pruned_data = { map { $_ => $data->{$_} } qw(id path) };
		$pruned_data;
	} else {
		(); # return nothing
	}
} $data;

use DDP; p @videos;

