From 7b246b576f797b536139e4782a0bc2f8089c125e Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sun, 7 Sep 2025 16:47:27 -0300 Subject: [PATCH] Prevent player microformat from being overwritten by the next microformat Closes https://github.com/iv-org/invidious/issues/5443 The player microformat is what we need to get the published date, premiere timestamp, allowed regions and more information of the video. Youtube introduced a new `microformat.microformatDataRenderer` in the next endpoint which overwrote the player microformat `microformat.playerMicroformatRenderer` when merged --- src/invidious/videos/parser.cr | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 5335aa794..fb10bf340 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -102,6 +102,9 @@ def extract_video_info(video_id : String) # Don't fetch the next endpoint if the video is unavailable. if {"OK", "LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status) next_response = YoutubeAPI.next({"videoId": video_id, "params": ""}) + # Remove the microformat returned by the /next endpoint on some videos + # to prevent player_response microformat from being overwritten. + next_response.reject!("microformat") player_response = player_response.merge(next_response) end