parser: Deal with missing lengthSeconds in video_details.

This commit is contained in:
mk-pmb feat. Emilien Devos 2025-04-11 15:23:00 +02:00
parent fe7355126a
commit a9dfc70280

View File

@ -217,7 +217,7 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
views_txt ||= video_details["viewCount"]?.try &.as_s || ""
views = views_txt.gsub(/\D/, "").to_i64?
length_txt = (microformat["lengthSeconds"]? || video_details["lengthSeconds"])
length_txt = (microformat["lengthSeconds"]? || video_details["lengthSeconds"]?)
.try &.as_s.to_i64
published = microformat["publishDate"]?