summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-08-17 16:08:07 -0500
committerOmar Roth <omarroth@hotmail.com>2018-08-17 16:08:07 -0500
commit567b9f31f3140eb3723d14dbd2ed17483fb36847 (patch)
tree68611ea71e9295a68a82e3a64d596831188dc425
parent6bb747b579530abf59a9dd651dc2038a540e50b8 (diff)
downloadinvidious-567b9f31f3140eb3723d14dbd2ed17483fb36847.tar.gz
invidious-567b9f31f3140eb3723d14dbd2ed17483fb36847.tar.bz2
invidious-567b9f31f3140eb3723d14dbd2ed17483fb36847.zip
Add fix for livestreams in search results
-rw-r--r--src/invidious/helpers/helpers.cr9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
index 5f29ee8d..a7a8158f 100644
--- a/src/invidious/helpers/helpers.cr
+++ b/src/invidious/helpers/helpers.cr
@@ -303,8 +303,13 @@ def extract_videos(nodeset, ucid = nil)
published = Time.epoch(metadata[0].xpath_node(%q(.//span)).not_nil!["data-timestamp"].to_i64)
else
# Livestream
- view_count = metadata[0].content.delete("Streamed, watching").to_i64
- published = Time.now
+ if metadata[0].content.starts_with? "Streamed "
+ view_count = 0_i64
+ published = decode_date(metadata[0].content.lchop("Streamed "))
+ else
+ view_count = metadata[0].content.delete(" watching,").to_i64
+ published = Time.now
+ end
end
else
published = decode_date(metadata[0].content)