Use dig?() for playlist title

pull/2719/head
Samantaz Fox 2021-12-08 01:38:09 +01:00
rodzic 6c8a5a1e7f
commit 3b1a286290
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F42821059186176E
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -352,7 +352,7 @@ def fetch_playlist(plid, locale)
playlist_info = playlist_sidebar_renderer[0]["playlistSidebarPrimaryInfoRenderer"]? playlist_info = playlist_sidebar_renderer[0]["playlistSidebarPrimaryInfoRenderer"]?
raise InfoException.new("Could not extract playlist info") if !playlist_info raise InfoException.new("Could not extract playlist info") if !playlist_info
title = playlist_info["title"]?.try &.["runs"][0]?.try &.["text"]?.try &.as_s || "" title = playlist_info.dig?("title", "runs", 0, "text").try &.as_s || ""
desc_item = playlist_info["description"]? desc_item = playlist_info["description"]?