fix playlists parsing for playlists without metadataParts

On some channels like MrBeast, metadataParts is absent, missing the
author information, this is intended behaviour by Youtube since there is
no author information attached to them.

Example URL: https://www.youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA/playlists
This commit is contained in:
Fijxu 2026-05-22 23:09:05 -04:00
parent ae1be83b43
commit 8934050961

View File

@ -755,8 +755,8 @@ private module Parsers
# "metadataParts": [ ... ] <-- metadataParts with the information we are searching for.
# }
# ]
metadata_parts = metadata.dig("metadata", "contentMetadataViewModel", "metadataRows")
.as_a.find { |row| row["metadataParts"]? }
metadata_parts = metadata.dig?("metadata", "contentMetadataViewModel", "metadataRows").try &.as_a
.find { |row| row["metadataParts"]? }
.try &.dig("metadataParts", 0)
if author_info = metadata_parts.try &.["text"]?