File tree Expand file tree Collapse file tree 1 file changed +34
-22
lines changed
Expand file tree Collapse file tree 1 file changed +34
-22
lines changed Original file line number Diff line number Diff line change @@ -1052,20 +1052,30 @@ sub _get_youtubei_content {
10521052
10531053 require Time::Piece;
10541054
1055- # <<<
1056- # ~ my %android = (
1057- # ~ "videoId" => $videoID,
1058- # ~ "context" => {
1059- # ~ "client" => {
1060- # ~ "hl" => "en",
1061- # ~ "gl" => "US",
1062- # ~ "clientName" => "ANDROID",
1063- # ~ "clientVersion" => "16.20",
1064- # ~ %args,
1065- # ~ },
1066- # ~ },
1067- # ~ );
1068- # >>>
1055+ my %android = (
1056+ " videoId" => $videoID ,
1057+ " context" => {
1058+ " client" => {
1059+ " hl" => " en" ,
1060+ " gl" => " US" ,
1061+ " clientName" => " ANDROID" ,
1062+
1063+ # "clientVersion" => "16.20",
1064+ ' clientVersion' => ' 17.31.35' ,
1065+ ' androidSdkVersion' => 30,
1066+ ' userAgent' => ' com.google.android.youtube/17.31.35 (Linux; U; Android 11) gzip' ,
1067+ %args ,
1068+ }
1069+ },
1070+ );
1071+
1072+ $self -> {lwp } // $self -> set_lwp_useragent();
1073+
1074+ my $agent = $self -> {lwp }-> agent;
1075+
1076+ if ($endpoint ne ' next' ) {
1077+ $self -> {lwp }-> agent(' com.google.android.youtube/17.31.35 (Linux; U; Android 11) gzip' );
1078+ }
10691079
10701080 my %web = (
10711081 " videoId" => $videoID ,
@@ -1080,22 +1090,24 @@ sub _get_youtubei_content {
10801090 },
10811091 );
10821092
1083- my %android = (
1084- " videoId" => $videoID ,
1085- " context" => {
1086- " client" => {
1093+ if (0) {
1094+ %android = (
1095+ " videoId" => $videoID ,
1096+ " context" => {
1097+ " client" => {
10871098 " hl" => " en" ,
10881099 " gl" => " US" ,
10891100 " clientName" => " MWEB" ,
10901101 " clientVersion" => sprintf (" 2.%s .03.00" , Time::Piece-> new(time )-> strftime(" %Y%m%d " )),
10911102 %args ,
1092- }
1093- },
1094- );
1103+ }
1104+ },
1105+ );
1106+ }
10951107
10961108 local $self -> {access_token } = undef ;
10971109 my $content = $self -> post_as_json($url , $endpoint eq ' next' ? \%web : \%android );
1098-
1110+ $self -> { lwp } -> agent( $agent );
10991111 return $content ;
11001112}
11011113
You can’t perform that action at this time.
0 commit comments