Fix genreUrl

This commit is contained in:
Omar Roth 2020-06-16 17:51:49 -05:00
parent 056e7432bd
commit 38c7dda00f
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

@ -721,8 +721,8 @@ struct Video
info["genre"]?.try &.as_s || "" info["genre"]?.try &.as_s || ""
end end
def genre_url : String def genre_url : String?
info["genreUcid"]? ? "/channel/#{info["genreUcid"]}" : "" info["genreUcid"]? ? "/channel/#{info["genreUcid"]}" : nil
end end
def license : String? def license : String?
@ -861,6 +861,9 @@ def extract_polymer_config(body)
.try &.["rows"]? .try &.["rows"]?
.try &.as_a .try &.as_a
params["genre"] = params["microformat"]?.try &.["playerMicroformatRenderer"]?.try &.["category"]? || JSON::Any.new("")
params["genreUrl"] = JSON::Any.new(nil)
metadata.try &.each do |row| metadata.try &.each do |row|
title = row["metadataRowRenderer"]?.try &.["title"]?.try &.["simpleText"]?.try &.as_s title = row["metadataRowRenderer"]?.try &.["title"]?.try &.["simpleText"]?.try &.as_s
contents = row["metadataRowRenderer"]? contents = row["metadataRowRenderer"]?