Use ProblematicTimelineItem as needed in playlists

This commit is contained in:
syeopite
2025-03-19 23:32:46 -07:00
parent c288005bfd
commit f7810ba007
4 changed files with 45 additions and 5 deletions

View File

@@ -12,13 +12,15 @@ module Invidious::Routes::Embed
url = "/playlist?list=#{plid}"
raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
end
get_first_video = videos[0].as(PlaylistVideo)
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
return error_template(500, ex)
end
url = "/embed/#{videos[0].id}?#{env.params.query}"
url = "/embed/#{get_first_video}?#{env.params.query}"
if env.params.query.size > 0
url += "?#{env.params.query}"
@@ -72,13 +74,15 @@ module Invidious::Routes::Embed
url = "/playlist?list=#{plid}"
raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
end
get_first_video = videos[0].as(PlaylistVideo)
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
return error_template(500, ex)
end
url = "/embed/#{videos[0].id}"
url = "/embed/#{get_first_video.id}"
elsif video_series
url = "/embed/#{video_series.shift}"
env.params.query["playlist"] = video_series.join(",")

View File

@@ -296,7 +296,13 @@ module Invidious::Routes::Feeds
xml.element("name") { xml.text playlist.author }
end
videos.each &.to_xml(xml)
videos.each do |video|
if video.is_a? PlaylistVideo
video.to_xml(xml)
else
video.to_xml(env, locale, xml)
end
end
end
end
else