mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-07 01:22:49 -05:00
Extract published time and view count from all metadata rows in LockupViewModel
This commit is contained in:
parent
821365cf71
commit
71d9409eca
@ -661,8 +661,9 @@ private module Parsers
|
|||||||
|
|
||||||
metadata = item_contents.dig("metadata", "lockupMetadataViewModel")
|
metadata = item_contents.dig("metadata", "lockupMetadataViewModel")
|
||||||
title = metadata.dig("title", "content").as_s
|
title = metadata.dig("title", "content").as_s
|
||||||
# Contains the views of the video and the published time of the video.
|
# Contains the views of the video and the published time of the video (supports multiple creators).
|
||||||
metadata_parts = metadata.dig("metadata", "contentMetadataViewModel", "metadataRows", 0, "metadataParts").try &.as_a
|
metadata_rows = metadata.dig?("metadata", "contentMetadataViewModel", "metadataRows").try &.as_a
|
||||||
|
metadata_parts = metadata_rows.try &.flat_map { |row| row.dig?("metadataParts").try &.as_a || [] of JSON::Any }
|
||||||
|
|
||||||
view_count_text = metadata_parts.try &.find { |item| item["icon"]?.nil? && item.dig?("text", "content").try &.as_s.includes?("views") }
|
view_count_text = metadata_parts.try &.find { |item| item["icon"]?.nil? && item.dig?("text", "content").try &.as_s.includes?("views") }
|
||||||
.try &.dig("text", "content").as_s
|
.try &.dig("text", "content").as_s
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user