xaicron / p5-www-youtube-download

YouTube video download interface.
http://blog.livedoor.jp/xaicron/
Other
38 stars 28 forks source link

'"' expected, at character offset 1 (before "args:{raw_player_res...") #69

Closed fluca1978 closed 3 months ago

fluca1978 commented 3 months ago

When executing the following snippet:

#!perl

use v5.38;

use WWW::YouTube::Download;

my $client = WWW::YouTube::Download->new;
my $video_id = q/Y1I1KcKvz9Q/;

my $video_url = $client->get_video_url($video_id);
my $title     = $client->get_title($video_id);     # maybe encoded utf8 string.
my $fmt       = $client->get_fmt($video_id);       # maybe highest quality.
my $suffix    = $client->get_suffix($video_id);    # maybe highest quality file suffix

say "URL $video_url";
say "TITLE $title";

I got the error:

% perl tmp/dl.pl   
'"' expected, at character offset 1 (before "args:{raw_player_res...") at /home/luca/perl5/perlbrew/perls/perl-5.38.0/lib/site_perl/5.38.0/WWW/YouTube/Download.pm line 298.
fluca1978 commented 3 months ago

Apparently, the line to decode as prefix is

{args:{raw_player_response:window.ytplayer.bootstrapPlayerResponse}}

but beside the need for double quotes, it is not parsed in any case.

oalders commented 3 months ago

I think this is fixed in the repository, but I haven't released a new version as there are failing tests. Are you able to test via using the repo directly?

fluca1978 commented 3 months ago

Tested with 1b83fb9b8ee68dc26e0f581dcd9ae1a456912040 and it works, even if I cannot download the video (opening a new issue for that).