summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadoslavL <rlelchev@abv.bg>2023-11-14 09:56:06 +0200
committerRadoslavL <rlelchev@abv.bg>2023-11-14 09:56:06 +0200
commit4c486634e26616a253e907ced0fe169e9a8de284 (patch)
treebec4cfcc623d81f9b81eabba6b39c500026b0efa
parent3bced4e12b6ecf26e0b3dfdb72aec8cf89197803 (diff)
downloadinvidious-4c486634e26616a253e907ced0fe169e9a8de284.tar.gz
invidious-4c486634e26616a253e907ced0fe169e9a8de284.tar.bz2
invidious-4c486634e26616a253e907ced0fe169e9a8de284.zip
Another attempt at fixing the issue
-rw-r--r--src/invidious/videos/parser.cr7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr
index 83c97602..dc9962bc 100644
--- a/src/invidious/videos/parser.cr
+++ b/src/invidious/videos/parser.cr
@@ -37,6 +37,11 @@ def parse_related_video(related : JSON::Any, published : String? = nil) : Hash(S
LOGGER.trace("parse_related_video: Found \"watchNextEndScreenRenderer\" container")
publishedText = related["publishedTimeText"]?
+ if !publishedText.nil?
+ publishedSimpleText = publishedText["simpleText"]
+ else
+ publishedSimpleText = nil
+ end
# TODO: when refactoring video types, make a struct for related videos
# or reuse an existing type, if that fits.
@@ -50,7 +55,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["simpleText"]?.to_s || ""),
+ "publishedText" => JSON::Any.new(publishedSimpleText || ""),
}
end