parser: Add fallbacks for author and ucid detection.

This commit is contained in:
mk-pmb feat. Emilien Devos 2025-04-11 15:29:00 +02:00
parent 30b593864b
commit ed2827b25f

View File

@ -446,6 +446,9 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
subs_text = author_info["subscriberCountText"]?
.try { |t| t["simpleText"]? || t.dig?("runs", 0, "text") }
.try &.as_s.split(" ", 2)[0]
author ||= author_info.dig?("title", "runs", 0, "text").try &.as_s
ucid ||= author_info.dig?("title", "runs", 0, "navigationEndpoint", "browseEndpoint", "browseId").try &.as_s
end
# Return data