fix!: make clip api less expensive

This commit is contained in:
Cameron Radmore 2026-08-02 16:19:46 -04:00
parent 51dd4fefd0
commit c7c8ade957
No known key found for this signature in database
GPG Key ID: 51E32B9B64747796
3 changed files with 2 additions and 13 deletions

View File

@ -460,7 +460,6 @@ feed_threads: 1
##
## Notes: The following API endpoints will be disabled:
## - /api/v1/videos
## - /api/v1/clips
## - /api/v1/transcripts
##
## Accepted values: true, false

View File

@ -136,7 +136,7 @@ end
class DisableAbusableAPIHandler < Kemal::Handler
{% for method in %w(GET HEAD) %}
# This endpoints make a video request to Invidious companion.
{% for endpoint in %w(videos clips transcripts) %}
{% for endpoint in %w(videos transcripts) %}
only ["/api/v1/{{ endpoint.id }}/:id"], {{ method }}
{% end %}
{% end %}

View File

@ -413,22 +413,12 @@ module Invidious::Routes::API::V1::Videos
start_time, end_time, clip_title = Invidious::Videos::Clip.parse_clip_parameters(params)
end
begin
video = get_video(video_id, region: region)
rescue ex : NotFoundException
return error_json(404, ex)
rescue ex
return error_json(500, ex)
end
return JSON.build do |json|
json.object do
json.field "startTime", start_time
json.field "endTime", end_time
json.field "clipTitle", clip_title
json.field "video" do
Invidious::JSONify::APIv1.video(video, json, locale: locale, proxy: proxy)
end
json.field "videoId", video_id
end
end
end