Invidious is an alternative front-end to YouTube
Add fix for comments that don't have valid continuation
Omar Roth9a0996515f01
diff --git a/src/invidious.cr b/src/invidious.crindex 1a739ae4..5d6a5e51 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -558,6 +558,12 @@ get "/api/v1/comments/:id" do |env|response = client.post("/comment_service_ajax?action_get_comments=1&pbj=1&ctoken=#{ctoken}&continuation=#{continuation}&itct=#{itct}", headers, post_req).bodyresponse = JSON.parse(response)+ env.response.content_type = "application/json"++ if !response["response"]["continuationContents"]?+ halt env, status_code: 401+ end+response = response["response"]["continuationContents"]if response["commentRepliesContinuation"]?body = response["commentRepliesContinuation"]@@ -566,8 +572,6 @@ get "/api/v1/comments/:id" do |env|endcontents = body["contents"]?if !contents- env.response.content_type = "application/json"-if format == "json"next {"comments" => [] of String}.to_jsonelse@@ -649,7 +653,6 @@ get "/api/v1/comments/:id" do |env|endend- env.response.content_type = "application/json"if format == "json"next commentselse@@ -676,7 +679,6 @@ get "/api/v1/comments/:id" do |env|halt env, status_code: 404end- env.response.content_type = "application/json"{"title" => reddit_thread.title,"permalink" => reddit_thread.permalink,"content_html" => content_html}.to_json