diff --git a/lib/WWW/PipeViewer.pm b/lib/WWW/PipeViewer.pm index 3f8f8eb..27ea85a 100644 --- a/lib/WWW/PipeViewer.pm +++ b/lib/WWW/PipeViewer.pm @@ -9,11 +9,12 @@ use WWW::PipeViewer::ParseJSON; #<<< use Memoize::Expire; -tie my %youtubei_cache => 'Memoize::Expire', +tie my %_INTERNAL_CACHE => 'Memoize::Expire', LIFETIME => 600, # in seconds - NUM_USES => 2; + NUM_USES => 3; -memoize '_get_youtubei_content', SCALAR_CACHE => [HASH => \%youtubei_cache]; +memoize '_get_youtubei_content', SCALAR_CACHE => [HASH => \%_INTERNAL_CACHE]; +memoize '_info_from_ytdl', SCALAR_CACHE => [HASH => \%_INTERNAL_CACHE]; #>>> #memoize('_get_video_info'); @@ -126,7 +127,8 @@ my %valid_options = ( #<<< # LWP user agent #user_agent => {valid => qr/^.{5}/, default => 'Mozilla/5.0 (iPad; CPU OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D201 Safari/9537.53'}, - user_agent => {valid => qr/^.{5}/, default => 'Mozilla/5.0 (Android 11; Tablet; rv:83.0) Gecko/83.0 Firefox/83.0,gzip(gfe)'}, + #user_agent => {valid => qr/^.{5}/, default => 'Mozilla/5.0 (Android 11; Tablet; rv:83.0) Gecko/83.0 Firefox/83.0,gzip(gfe)'}, + user_agent => {valid => qr/^.{5}/, default => 'Mozilla/5.0 (Android 16 Beta 2; Mobile; rv:136.0) Gecko/136.0 Firefox/136.0,gzip(gfe)'}, #>>> ); @@ -862,7 +864,7 @@ sub _ytdl_is_available { sub _info_from_ytdl { my ($self, $videoID) = @_; - $self->_ytdl_is_available() || return; + $self->_ytdl_is_available() || return undef; my @ytdl_cmd = ($self->get_ytdl_cmd(), '--all-formats', '--dump-single-json'); @@ -873,7 +875,7 @@ sub _info_from_ytdl { } my $json = $self->proxy_stdout(@ytdl_cmd, quotemeta("https://www.youtube.com/watch?v=" . $videoID)); - my $ref = parse_json_string($json // return); + my $ref = parse_json_string($json // return undef); if ($self->get_debug >= 3) { require Data::Dump; @@ -1126,7 +1128,7 @@ sub _get_youtubei_content { require Time::Piece; - my $android_useragent = 'com.google.android.youtube/18.11.34 (Linux; U; Android 11) gzip'; + my $android_useragent = 'com.google.android.youtube/20.10.38 (Linux; U; Android 11) gzip'; my %android = ( "videoId" => $videoID, @@ -1135,7 +1137,7 @@ sub _get_youtubei_content { 'hl' => 'en', 'gl' => 'US', 'clientName' => 'ANDROID', - 'clientVersion' => '18.11.34', + 'clientVersion' => '20.10.38', 'androidSdkVersion' => 30, 'userAgent' => $android_useragent, %args, diff --git a/lib/WWW/PipeViewer/InitialData.pm b/lib/WWW/PipeViewer/InitialData.pm index f868698..126b876 100644 --- a/lib/WWW/PipeViewer/InitialData.pm +++ b/lib/WWW/PipeViewer/InitialData.pm @@ -1209,10 +1209,10 @@ sub yt_browse_request { context => { client => { browserName => "Firefox", - browserVersion => "122.0", + browserVersion => "136.0", clientFormFactor => "LARGE_FORM_FACTOR", clientName => "MWEB", - clientVersion => "2.20240201.00.00", + clientVersion => "2.20250314.01.00", deviceMake => "Mozilla", deviceModel => "Firefox for Android", hl => "en", @@ -1221,15 +1221,15 @@ sub yt_browse_request { }, originalUrl => $url, osName => "Android", - osVersion => "14", - platform => "TABLET", + osVersion => "16", + platform => "MOBILE", playerType => "UNIPLAYER", screenDensityFloat => 1, screenHeightPoints => 500, screenPixelDensity => 1, screenWidthPoints => 1800, timeZone => "UTC", - userAgent => "Mozilla/5.0 (Android 14; Tablet; rv:109.0) Gecko/122.0 Firefox/122.0,gzip(gfe)", + userAgent => "Mozilla/5.0 (Android 16 Beta 2; Mobile; rv:136.0) Gecko/136.0 Firefox/136.0,gzip(gfe)", userInterfaceTheme => "USER_INTERFACE_THEME_LIGHT", utcOffsetMinutes => 0, }, @@ -1286,10 +1286,10 @@ sub yt_search_next_page { "context" => { "client" => { "browserName" => "Firefox", - "browserVersion" => "122.0", + "browserVersion" => "136.0", "clientFormFactor" => "LARGE_FORM_FACTOR", "clientName" => "MWEB", - "clientVersion" => "2.20240201.00.00", + "clientVersion" => "2.20250314.01.00", "deviceMake" => "Mozilla", "deviceModel" => "Firefox for Android", "gl" => "US", @@ -1298,14 +1298,14 @@ sub yt_search_next_page { "graftUrl" => $url, }, "osName" => "Android", - "osVersion" => "14", - "platform" => "TABLET", + "osVersion" => "16", + "platform" => "MOBILE", "playerType" => "UNIPLAYER", "screenDensityFloat" => 1, "screenHeightPoints" => 600, "screenPixelDensity" => 1, "screenWidthPoints" => 1800, - "userAgent" => "Mozilla/5.0 (Android 14; Tablet; rv:109.0) Gecko/122.0 Firefox/122.0,gzip(gfe)", + "userAgent" => "Mozilla/5.0 (Android 16 Beta 2; Mobile; rv:136.0) Gecko/136.0 Firefox/136.0,gzip(gfe)", "userInterfaceTheme" => "USER_INTERFACE_THEME_LIGHT", "utcOffsetMinutes" => 0, },