summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrahim Hadriche <brahim.hadriche@gmail.com>2024-10-26 12:40:31 -0400
committerBrahim Hadriche <brahim.hadriche@gmail.com>2024-10-26 12:40:31 -0400
commitee728092823d8e82f71f35c31da8a27efec0f1b5 (patch)
tree4af41356cfa50aad703a54c4ed76341efa0ccfdc
parentd8b893e9ad456598a3e127cec578dd3355141578 (diff)
downloadinvidious-ee728092823d8e82f71f35c31da8a27efec0f1b5.tar.gz
invidious-ee728092823d8e82f71f35c31da8a27efec0f1b5.tar.bz2
invidious-ee728092823d8e82f71f35c31da8a27efec0f1b5.zip
[Alternative] Fix for channel live videos
-rw-r--r--src/invidious/channels/videos.cr64
1 files changed, 46 insertions, 18 deletions
diff --git a/src/invidious/channels/videos.cr b/src/invidious/channels/videos.cr
index 6cc30142..e29d80ed 100644
--- a/src/invidious/channels/videos.cr
+++ b/src/invidious/channels/videos.cr
@@ -23,29 +23,57 @@ def produce_channel_content_continuation(ucid, content_type, page = 1, auto_gene
else 15 # Fallback to "videos"
end
- sort_by_numerical =
- case sort_by
- when "newest" then 1_i64
- when "popular" then 2_i64
- when "oldest" then 4_i64
- else 1_i64 # Fallback to "newest"
- end
+ if content_type == "livestreams"
+ sort_by_numerical =
+ case sort_by
+ when "newest" then 12_i64
+ when "popular" then 14_i64
+ when "oldest" then 13_i64
+ else 12_i64 # Fallback to "newest"
+ end
+ else
+ sort_by_numerical =
+ case sort_by
+ when "newest" then 1_i64
+ when "popular" then 2_i64
+ when "oldest" then 4_i64
+ else 1_i64 # Fallback to "newest"
+ end
+ end
- object_inner_1 = {
- "110:embedded" => {
- "3:embedded" => {
- "#{content_type_numerical}:embedded" => {
- "1:embedded" => {
- "1:string" => object_inner_2_encoded,
+ if content_type == "livestreams"
+ object_inner_1 = {
+ "110:embedded" => {
+ "3:embedded" => {
+ "#{content_type_numerical}:embedded" => {
+ "1:embedded" => {
+ "1:string" => object_inner_2_encoded,
+ },
+ "2:embedded" => {
+ "1:string" => "00000000-0000-0000-0000-000000000000",
+ },
+ "5:varint" => sort_by_numerical,
},
- "2:embedded" => {
- "1:string" => "00000000-0000-0000-0000-000000000000",
+ },
+ },
+ }
+ else
+ object_inner_1 = {
+ "110:embedded" => {
+ "3:embedded" => {
+ "#{content_type_numerical}:embedded" => {
+ "1:embedded" => {
+ "1:string" => object_inner_2_encoded,
+ },
+ "2:embedded" => {
+ "1:string" => "00000000-0000-0000-0000-000000000000",
+ },
+ "3:varint" => sort_by_numerical,
},
- "3:varint" => sort_by_numerical,
},
},
- },
- }
+ }
+ end
object_inner_1_encoded = object_inner_1
.try { |i| Protodec::Any.cast_json(i) }