mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:35:38 -04:00
Fix mix continuation
This commit is contained in:
parent
c55c553725
commit
468e6b1c27
@ -3005,6 +3005,14 @@ get "/api/v1/mixes/:rdid" do |env|
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
mix = fetch_mix(rdid, continuation)
|
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
|
rescue ex
|
||||||
error_message = {"error" => ex.message}.to_json
|
error_message = {"error" => ex.message}.to_json
|
||||||
halt env, status_code: 500, response: error_message
|
halt env, status_code: 500, response: error_message
|
||||||
@ -3045,6 +3053,7 @@ get "/api/v1/mixes/:rdid" do |env|
|
|||||||
response = JSON.parse(response)
|
response = JSON.parse(response)
|
||||||
playlist_html = template_mix(response)
|
playlist_html = template_mix(response)
|
||||||
next_video = response["videos"].as_a[1]?.try &.["videoId"]
|
next_video = response["videos"].as_a[1]?.try &.["videoId"]
|
||||||
|
next_video ||= ""
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
"playlistHtml" => playlist_html,
|
"playlistHtml" => playlist_html,
|
||||||
|
Loading…
Reference in New Issue
Block a user