From c7c8ade95738adaba122b870c6e5cbb00f77a0fe Mon Sep 17 00:00:00 2001 From: Cameron Radmore Date: Sun, 2 Aug 2026 16:19:46 -0400 Subject: [PATCH] fix!: make clip api less expensive --- config/config.example.yml | 1 - src/invidious/helpers/handlers.cr | 2 +- src/invidious/routes/api/v1/videos.cr | 12 +----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 85fdd0cd8..18ef205e3 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -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 diff --git a/src/invidious/helpers/handlers.cr b/src/invidious/helpers/handlers.cr index 8395c7a4d..ad364b4e2 100644 --- a/src/invidious/helpers/handlers.cr +++ b/src/invidious/helpers/handlers.cr @@ -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 %} diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr index 0a5d5a4ec..44268a1c1 100644 --- a/src/invidious/routes/api/v1/videos.cr +++ b/src/invidious/routes/api/v1/videos.cr @@ -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