summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-10-21 19:00:56 -0400
committerOmar Roth <omarroth@protonmail.com>2019-10-21 19:00:56 -0400
commit46a737c7a1c301ee9ed1634a916dc841544e72c9 (patch)
tree6f1598fb2c9a45a42c1f2dd5a4714690a7a15247
parenta731486ab7ad8272e4c2eee4265b6e5527d8b941 (diff)
downloadinvidious-46a737c7a1c301ee9ed1634a916dc841544e72c9.tar.gz
invidious-46a737c7a1c301ee9ed1634a916dc841544e72c9.tar.bz2
invidious-46a737c7a1c301ee9ed1634a916dc841544e72c9.zip
Skip deleted videos in playlist
-rw-r--r--src/invidious.cr7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index d17f3867..53eea7bc 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -4623,8 +4623,7 @@ end
if format == "html"
response = JSON.parse(response)
playlist_html = template_playlist(response)
- index = response["videos"].as_a[1]?.try &.["index"]
- next_video = response["videos"].as_a[1]?.try &.["videoId"]
+ index, next_video = response["videos"].as_a.skip(1).select { |video| !video["author"].as_s.empty? }[0]?.try {|v| {v["index"], v["videoId"] } } || {nil, nil}
response = {
"playlistHtml" => playlist_html,
@@ -4657,7 +4656,6 @@ get "/api/v1/mixes/:rdid" do |env|
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
@@ -4700,8 +4698,7 @@ get "/api/v1/mixes/:rdid" do |env|
if format == "html"
response = JSON.parse(response)
playlist_html = template_mix(response)
- next_video = response["videos"].as_a[1]?.try &.["videoId"]
- next_video ||= ""
+ next_video = response["videos"].as_a.select { |video| !video["author"].as_s.empty? }[0]?.try &.["videoId"]
response = {
"playlistHtml" => playlist_html,