Extractors: Don't error if AuthorId does not exist (#3869)

Some playlist author's don't have a YouTube channel, so does movies.
This caused various extractors (related videos, search) to fail.

Closes the following issues:
2530, 3349, 3766, 3812, 4133
This commit is contained in:
Samantaz Fox
2024-02-12 21:54:17 +01:00
3 changed files with 29 additions and 13 deletions

View File

@@ -822,9 +822,9 @@ module HelperExtractors
end
# Retrieves the ID required for querying the InnerTube browse endpoint.
# Raises when it's unable to do so
# Returns an empty string when it's unable to do so
def self.get_browse_id(container)
return container.dig("navigationEndpoint", "browseEndpoint", "browseId").as_s
return container.dig?("navigationEndpoint", "browseEndpoint", "browseId").try &.as_s || ""
end
end