mirror of
				https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
				synced 2024-08-15 00:53:38 +00:00 
			
		
		
		
	Skip deleted videos in playlist
This commit is contained in:
		
							parent
							
								
									a731486ab7
								
							
						
					
					
						commit
						46a737c7a1
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -4623,8 +4623,7 @@ end
 | 
				
			||||||
    if format == "html"
 | 
					    if format == "html"
 | 
				
			||||||
      response = JSON.parse(response)
 | 
					      response = JSON.parse(response)
 | 
				
			||||||
      playlist_html = template_playlist(response)
 | 
					      playlist_html = template_playlist(response)
 | 
				
			||||||
      index = response["videos"].as_a[1]?.try &.["index"]
 | 
					      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}
 | 
				
			||||||
      next_video = response["videos"].as_a[1]?.try &.["videoId"]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      response = {
 | 
					      response = {
 | 
				
			||||||
        "playlistHtml" => playlist_html,
 | 
					        "playlistHtml" => playlist_html,
 | 
				
			||||||
| 
						 | 
					@ -4657,7 +4656,6 @@ get "/api/v1/mixes/:rdid" do |env|
 | 
				
			||||||
      mix = fetch_mix(rdid, mix.videos[1].id)
 | 
					      mix = fetch_mix(rdid, mix.videos[1].id)
 | 
				
			||||||
      index = mix.videos.index(mix.videos.select { |video| video.id == continuation }[0]?)
 | 
					      index = mix.videos.index(mix.videos.select { |video| video.id == continuation }[0]?)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    index ||= 0
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mix.videos = mix.videos[index..-1]
 | 
					    mix.videos = mix.videos[index..-1]
 | 
				
			||||||
  rescue ex
 | 
					  rescue ex
 | 
				
			||||||
| 
						 | 
					@ -4700,8 +4698,7 @@ get "/api/v1/mixes/:rdid" do |env|
 | 
				
			||||||
  if format == "html"
 | 
					  if format == "html"
 | 
				
			||||||
    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.select { |video| !video["author"].as_s.empty? }[0]?.try &.["videoId"]
 | 
				
			||||||
    next_video ||= ""
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    response = {
 | 
					    response = {
 | 
				
			||||||
      "playlistHtml" => playlist_html,
 | 
					      "playlistHtml" => playlist_html,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue