diff options
| author | ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> | 2023-03-07 14:23:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-07 14:23:08 -0500 |
| commit | e3081ef1a93973fe10ba8508ad31d257d641350e (patch) | |
| tree | 8f637ac32b091c560439498c4f0e293e0688f87d /src | |
| parent | 742c951bc9fdc6eb1e5687104e67500fb778e0ea (diff) | |
| download | invidious-e3081ef1a93973fe10ba8508ad31d257d641350e.tar.gz invidious-e3081ef1a93973fe10ba8508ad31d257d641350e.tar.bz2 invidious-e3081ef1a93973fe10ba8508ad31d257d641350e.zip | |
Apply style change suggestions
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/videos.cr | 7 | ||||
| -rw-r--r-- | src/invidious/videos/parser.cr | 10 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 86f5ada4..0038a97a 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -249,7 +249,12 @@ struct Video def music : Array(VideoMusic) info["music"].as_a.map { |music_json| - VideoMusic.new(music_json["song"].as_s, music_json["album"].as_s, music_json["artist"].as_s, music_json["license"].as_s) + VideoMusic.new( + music_json["song"].as_s, + music_json["album"].as_s, + music_json["artist"].as_s, + music_json["license"].as_s + ) } end diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 722c90e8..7cfc7ea7 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -325,12 +325,10 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any album = nil music_license = nil - # used when multiple songs - song = music_desc.dig?("carouselLockupRenderer", "videoLockup", "compactVideoRenderer", "title", "simpleText") - - # used when multiple songs and the song has a link - if !song - song = music_desc.dig("carouselLockupRenderer", "videoLockup", "compactVideoRenderer", "title", "runs", 0, "text") + # Used when the video has multiple songs + if song_title = music_desc.dig?("carouselLockupRenderer", "videoLockup", "compactVideoRenderer", "title") + # "simpleText" for plain text / "runs" when song has a link + song = song_title["simpleText"]? || song_title.dig("runs", 0, "text") end music_desc.dig?("carouselLockupRenderer", "infoRows").try &.as_a.each do |desc| |
