summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrank de Lange <github-f@unternet.org>2021-10-12 20:17:45 +0200
committerGitHub <noreply@github.com>2021-10-12 18:17:45 +0000
commit3dc980e80051cf1d5dc4a224fb57823612c4bc94 (patch)
treea88dbabe9ba60214cdf0823313b369a1b2c196c2 /src
parent39c27f0c66b82f04a190a0d8dc4e5a7023f066cc (diff)
downloadinvidious-3dc980e80051cf1d5dc4a224fb57823612c4bc94.tar.gz
invidious-3dc980e80051cf1d5dc4a224fb57823612c4bc94.tar.bz2
invidious-3dc980e80051cf1d5dc4a224fb57823612c4bc94.zip
Fix for #2488 - parse contents of search results of type=Category (#2496)
* Fix for #2488 - parse contents of search results of type=Category (returned on first page for universal (type=all) queries instead of returning an error. * Moved content array walker to Category#to_json As requested by reviewer this change moves the content array walker from the API endpoint to the Category class. * Update src/invidious/helpers/serialized_yt_data.cr Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/serialized_yt_data.cr9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr
index 61356555..a9798f0c 100644
--- a/src/invidious/helpers/serialized_yt_data.cr
+++ b/src/invidious/helpers/serialized_yt_data.cr
@@ -237,8 +237,15 @@ class Category
def to_json(locale, json : JSON::Builder)
json.object do
+ json.field "type", "category"
json.field "title", self.title
- json.field "contents", self.contents
+ json.field "contents" do
+ json.array do
+ self.contents.each do |item|
+ item.to_json(locale, json)
+ end
+ end
+ end
end
end