#!/usr/bin/perl

use strict;
use warnings;

my $YT_DL_PATH = `which yt-dlp`;
chomp $YT_DL_PATH;

my $YT_DL_CMD = $YT_DL_PATH . " " . "-f 'ba' -x --audio-format mp3";
my $YT_DL_SUFFIX = "-o '%(id)s.%(ext)s'";

my $INPUT = "videos.txt";

foreach my $link ( split("\n", `/bin/cat $INPUT`) ) {
print("Downloading $link\n");
my $local_cmd = $YT_DL_CMD . " $link " . $YT_DL_SUFFIX;
print("$local_cmd\n");
`$local_cmd`;
}