mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-06 00:52:45 -05:00
fix!: make clip api less expensive
This commit is contained in:
parent
51dd4fefd0
commit
c7c8ade957
@ -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
|
||||
|
||||
@ -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 %}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user