diff --git a/lib/WWW/StrawViewer.pm b/lib/WWW/StrawViewer.pm index d3cc90b..ad369b1 100644 --- a/lib/WWW/StrawViewer.pm +++ b/lib/WWW/StrawViewer.pm @@ -756,12 +756,11 @@ sub _extract_from_ytdl { my $cookie_file = $self->get_cookie_file; if (defined($cookie_file) and -f $cookie_file) { - push @ytdl_cmd, '--cookies', $cookie_file; + push @ytdl_cmd, '--cookies', quotemeta($cookie_file); } my $json = $self->proxy_stdout(@ytdl_cmd, quotemeta("https://www.youtube.com/watch?v=" . $videoID)); - - my $ref = $self->parse_json_string($json); + my $ref = $self->parse_json_string($json); my @formats; if (ref($ref) eq 'HASH' and exists($ref->{formats}) and ref($ref->{formats}) eq 'ARRAY') { diff --git a/lib/WWW/StrawViewer/Search.pm b/lib/WWW/StrawViewer/Search.pm index 01ea68b..dcea562 100644 --- a/lib/WWW/StrawViewer/Search.pm +++ b/lib/WWW/StrawViewer/Search.pm @@ -167,16 +167,16 @@ sub related_to_videoID { my $viewCount = 0; - if ($info->{viewCountText}{simpleText} =~ /^([\d,]+) views/) { + if (($info->{viewCountText}{simpleText} // '') =~ /^([\d,]+) views/) { $viewCount = ($1 =~ tr/,//dr); } - elsif ($info->{viewCountText}{simpleText} =~ /Recommended for you/i) { + elsif (($info->{viewCountText}{simpleText} // '') =~ /Recommended for you/i) { next; # filter out recommended videos from related videos } my $lengthSeconds = 0; - if ($info->{lengthText}{simpleText} =~ /([\d:]+)/) { + if (($info->{lengthText}{simpleText} // '') =~ /([\d:]+)/) { my $time = $1; my @fields = split(/:/, $time);