From f54c10004da0aaf8bcb59cc843c2fee72c667574 Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 12 Oct 2021 04:09:01 -0700 Subject: [PATCH] Readd removed comments --- src/invidious/helpers/macros.cr | 1 + src/invidious/yt_backend/extractors.cr | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/invidious/helpers/macros.cr b/src/invidious/helpers/macros.cr index 75df1612..01dcfb6b 100644 --- a/src/invidious/helpers/macros.cr +++ b/src/invidious/helpers/macros.cr @@ -9,6 +9,7 @@ module DB::Serializable }} end + # Initialize DB::Serializable descendants via NamedTuples def initialize(tuple) \{% for var in @type.instance_vars %} \{% ann = var.annotation(::DB::Field) %} diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index 1bea4c7b..b06f8f00 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -61,9 +61,12 @@ private module Parsers # Typically views are stored under a "simpleText" in the "viewCountText". However, for # livestreams and premiered it is stored under a "runs" array: [{"text":123}, {"text": "watching"}] # When view count is disabled the "viewCountText" is not present on InnerTube data. - # TODO change default value to nil and typical encoding type to tuple storing type (watchers, views, etc) + # TODO change default value to nil and change the view_count to tuple storing type (watchers, views, etc) # and count view_count = item_contents.dig?("viewCountText", "simpleText").try &.as_s.gsub(/\D+/, "").to_i64? || 0_i64 + + # TODO YouTube seems to have removed the description_html snippet and replaced it with "snippetText" + # inside the detailedMetadataSnippets attribute description_html = item_contents["descriptionSnippet"]?.try { |t| parse_content(t) } || "" # The length information *should* only always exist in "lengthText". However, the legacy Invidious code