diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-10-31 09:15:17 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-10-31 09:24:24 -0500 |
| commit | 468e6b1c270503496ad0b55efe5d7fc2131d9e5c (patch) | |
| tree | 9810da341155cad93314af41349ca50b1dd9eb04 | |
| parent | c55c5537257f2e12ddecb74a1e44b4fbd969f1b7 (diff) | |
| download | invidious-468e6b1c270503496ad0b55efe5d7fc2131d9e5c.tar.gz invidious-468e6b1c270503496ad0b55efe5d7fc2131d9e5c.tar.bz2 invidious-468e6b1c270503496ad0b55efe5d7fc2131d9e5c.zip | |
Fix mix continuation
| -rw-r--r-- | src/invidious.cr | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 802e9233..8fcb66e3 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -3005,6 +3005,14 @@ get "/api/v1/mixes/:rdid" do |env| begin mix = fetch_mix(rdid, continuation) + + if !rdid.ends_with? continuation + mix = fetch_mix(rdid, mix.videos[1].id) + index = mix.videos.index(mix.videos.select { |video| video.id == continuation }[0]?) + end + index ||= 0 + + mix.videos = mix.videos[index..-1] rescue ex error_message = {"error" => ex.message}.to_json halt env, status_code: 500, response: error_message @@ -3045,6 +3053,7 @@ get "/api/v1/mixes/:rdid" do |env| response = JSON.parse(response) playlist_html = template_mix(response) next_video = response["videos"].as_a[1]?.try &.["videoId"] + next_video ||= "" response = { "playlistHtml" => playlist_html, |
