diff options
author | trizen <trizen@protonmail.com> | 2020-09-27 09:56:51 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-09-28 22:24:12 -0500 |
commit | 256be95193598233bd2abd18d80499c476f61fbf (patch) | |
tree | 9635e6d38a11e870c2d1de3ed878ce9e7b8e2350 | |
parent | 27774c9579fad5b7595c3f936597307feadaef9d (diff) | |
download | fair-viewer-256be95193598233bd2abd18d80499c476f61fbf.tar.lz fair-viewer-256be95193598233bd2abd18d80499c476f61fbf.tar.xz fair-viewer-256be95193598233bd2abd18d80499c476f61fbf.zip |
quotemeta() the filename of the cookie file when passing it to `hypervideo`.
This now allows the filename to contain shell metacharacters.
Signed-off-by: Jesús <heckyel@hyperbola.info>
-rw-r--r-- | lib/WWW/FairViewer.pm | 5 | ||||
-rw-r--r-- | lib/WWW/FairViewer/Search.pm | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/WWW/FairViewer.pm b/lib/WWW/FairViewer.pm index 5657c4c..977e8af 100644 --- a/lib/WWW/FairViewer.pm +++ b/lib/WWW/FairViewer.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/FairViewer/Search.pm b/lib/WWW/FairViewer/Search.pm index af6005b..6f4e8d0 100644 --- a/lib/WWW/FairViewer/Search.pm +++ b/lib/WWW/FairViewer/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); |