summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsyeopite <syeopite@syeopite.dev>2021-06-28 23:51:04 -0700
committersyeopite <syeopite@syeopite.dev>2021-09-24 21:07:07 -0700
commit30e85b40f9b817c8620ef9536ad2d327da9ba83b (patch)
treebcb80c59e8e126b65de0bd26a584495a19a9b622 /src
parentbe1a43a3377c543b84fd9bd534fd2033b7223e62 (diff)
downloadinvidious-30e85b40f9b817c8620ef9536ad2d327da9ba83b.tar.gz
invidious-30e85b40f9b817c8620ef9536ad2d327da9ba83b.tar.bz2
invidious-30e85b40f9b817c8620ef9536ad2d327da9ba83b.zip
Fix extract_videos
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/helpers.cr11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
index a52c7bd4..99adcd30 100644
--- a/src/invidious/helpers/helpers.cr
+++ b/src/invidious/helpers/helpers.cr
@@ -250,10 +250,13 @@ end
def extract_videos(initial_data : Hash(String, JSON::Any), author_fallback : String? = nil, author_id_fallback : String? = nil)
extracted = extract_items(initial_data, author_fallback, author_id_fallback)
- if extracted.is_a?(Category)
- target = extracted.contents
- else
- target = extracted
+ target = [] of SearchItem
+ extracted.each do |i|
+ if i.is_a?(Category)
+ i.contents.each { |cate_i| target << cate_i if !cate_i.is_a? Video }
+ else
+ target << i
+ end
end
return target.select(&.is_a?(SearchVideo)).map(&.as(SearchVideo))
end