Corrected usage of publishedText variable throughout the code

This commit is contained in:
RadoslavL 2024-08-16 13:54:27 +03:00
parent 7b7197cde8
commit cab02d4959
2 changed files with 5 additions and 2 deletions

View file

@ -246,7 +246,11 @@ module Invidious::JSONify::APIv1
json.field "viewCountText", rv["short_view_count"]?
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
json.field "published", rv["published"]?
json.field "publishedTimeText", translate(locale, "`x` ago", rv["publishedText"].to_s.gsub(" ago", ""))
if !rv[published].nil?
json.field "publishedText", translate(locale, "`x` ago", recode_date(rv[published], locale))
else
json.field "publishedText", translate(locale, "`x` ago", "NaN")
end
end
end
end

View file

@ -56,7 +56,6 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
"short_view_count" => JSON::Any.new(short_view_count || "0"),
"author_verified" => JSON::Any.new(author_verified),
"published" => JSON::Any.new(published || ""),
"publishedText" => JSON::Any.new(published_time_text || ""),
}
end