add song title for music tracks

This commit is contained in:
ChunkyProgrammer
2023-03-07 11:38:09 -05:00
parent 6b01629c5d
commit d8e23d34b6
6 changed files with 27 additions and 6 deletions

View File

@@ -322,6 +322,7 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
music_desclist.try &.as_a.each do |music_desc|
artist = nil
song = nil
album = nil
music_license = nil
@@ -329,13 +330,15 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
desc_title = extract_text(desc.dig?("infoRowRenderer", "title"))
if desc_title == "ARTIST"
artist = extract_text(desc.dig?("infoRowRenderer", "defaultMetadata"))
elsif desc_title == "SONG"
song = extract_text(desc.dig?("infoRowRenderer", "defaultMetadata"))
elsif desc_title == "ALBUM"
album = extract_text(desc.dig?("infoRowRenderer", "defaultMetadata"))
elsif desc_title == "LICENSES"
music_license = extract_text(desc.dig?("infoRowRenderer", "expandedMetadata"))
end
end
music_list << VideoMusic.new(album.to_s, artist.to_s, music_license.to_s)
music_list << VideoMusic.new(song.to_s, album.to_s, artist.to_s, music_license.to_s)
end
# Author infos