summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2020-01-08 20:26:47 -0500
committerOmar Roth <omarroth@protonmail.com>2020-01-08 20:26:47 -0500
commit4aada65dae72d1f563a6f3f816afd2299d66a3dc (patch)
treea8410277e2db44e20f067c91619bbe8ca04b60b0 /src
parent0560d2cfb7961b229bb0f91c869895e38f31e36d (diff)
downloadinvidious-4aada65dae72d1f563a6f3f816afd2299d66a3dc.tar.gz
invidious-4aada65dae72d1f563a6f3f816afd2299d66a3dc.tar.bz2
invidious-4aada65dae72d1f563a6f3f816afd2299d66a3dc.zip
Fix channel playlists for genre channels
Diffstat (limited to 'src')
-rw-r--r--src/invidious/channels.cr13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr
index 433fe074..7cd1bef1 100644
--- a/src/invidious/channels.cr
+++ b/src/invidious/channels.cr
@@ -533,8 +533,17 @@ def extract_channel_playlists_cursor(url, auto_generated)
.try { |i| Base64.decode(i) }
.try { |i| IO::Memory.new(i) }
.try { |i| Protodec::Any.parse(i) }
- .try { |i| i["80226972:0:embedded"]["3:1:base64"].as_h.find { |k, v| k.starts_with?("15:") } }
- .try &.[1].as_s || ""
+ .try { |i| i["80226972:0:embedded"]["3:1:base64"].as_h.find { |k, v| k.starts_with? "15:" } }
+ .try &.[1]
+
+ if cursor.try &.as_h?
+ cursor = cursor.try { |i| Protodec::Any.cast_json(i.as_h) }
+ .try { |i| Protodec::Any.from_json(i) }
+ .try { |i| Base64.urlsafe_encode(i) }
+ .try { |i| URI.encode_www_form(i) } || ""
+ else
+ cursor = cursor.try &.as_s || ""
+ end
if !auto_generated
cursor = URI.decode_www_form(cursor)