#EDIT: here is what lies in line 298 sub _get_args { my ($self, $content) = @_; my $data; for my $line (split "\n", $content) { next unless $line; if ($line =~ /the uploader has not made this video available in your country/i) { croak 'Video not available in your country'; } # The following regex looks like it is asking for trouble # memo-to-self: can't parse javascript with regex... elsif ($line =~ /^.+ytplayer\.config\s*=\s*(\{.*})/) { print STDERR "BBBBB: |||$1|||\n"; ($data, undef) = JSON->new->utf8(1)->decode_prefix($1); # <<< 298 last; } } croak 'failed to extract JSON data' unless $data->{args}; return $data->{args}; }