Invidious is an alternative front-end to YouTube
Added the text version of the published parameter
RadoslavLbe216fff9401
diff --git a/src/invidious/jsonify/api_v1/video_json.cr b/src/invidious/jsonify/api_v1/video_json.crindex 8a74343c..79f3d46f 100644--- a/src/invidious/jsonify/api_v1/video_json.cr+++ b/src/invidious/jsonify/api_v1/video_json.cr@@ -246,6 +246,7 @@ module Invidious::JSONify::APIv1json.field "viewCountText", rv["short_view_count"]?json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64json.field "published", rv["published"]?+ json.field "publishedTimeText", rv["publishedText"]?endendenddiff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.crindex c0e8a6ea..e8988587 100644--- a/src/invidious/videos/parser.cr+++ b/src/invidious/videos/parser.cr@@ -6,7 +6,7 @@ require "json"## TODO: "compactRadioRenderer" (Mix) and# TODO: Use a proper struct/class instead of a hacky JSON object-def parse_related_video(related : JSON::Any, published : String? = nil) : Hash(String, JSON::Any)?+def parse_related_video(related : JSON::Any, published : String? = nil, publishedText : String? = nil) : Hash(String, JSON::Any)?return nil if !related["videoId"]?# The compact renderer has video length in seconds, where the end@@ -48,6 +48,7 @@ def parse_related_video(related : JSON::Any, published : String? = nil) : Hash(S"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(publishedText || ""),}end@@ -237,12 +238,13 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Anysecondary_results.try &.as_a.each do |element|if item = element["compactVideoRenderer"]?if item["publishedTimeText"]?+ rv_published_time_text = item["publishedTimeText"].to_srv_decoded_time = decode_date(item["publishedTimeText"].to_s)rv_published_timestamp = rv_decoded_time.to_unix.to_selserv_published_timestamp = nilend- related_video = parse_related_video(item, published: rv_published_timestamp)+ related_video = parse_related_video(item, published: rv_published_timestamp, publishedText: rv_published_time_text)related << JSON::Any.new(related_video) if related_videoendend