mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-21 05:34:36 -05:00
Add error message for unavailable endpoint /api/v1/insights/:id
This commit is contained in:
parent
1af86f6afb
commit
586c0a0579
@ -2385,6 +2385,9 @@ get "/api/v1/insights/:id" do |env|
|
|||||||
id = env.params.url["id"]
|
id = env.params.url["id"]
|
||||||
env.response.content_type = "application/json"
|
env.response.content_type = "application/json"
|
||||||
|
|
||||||
|
error_message = {"error" => "YouTube has removed publicly-available analytics."}.to_json
|
||||||
|
halt env, status_code: 503, response: error_message
|
||||||
|
|
||||||
client = make_client(YT_URL)
|
client = make_client(YT_URL)
|
||||||
headers = HTTP::Headers.new
|
headers = HTTP::Headers.new
|
||||||
html = client.get("/watch?v=#{id}&gl=US&hl=en&disable_polymer=1")
|
html = client.get("/watch?v=#{id}&gl=US&hl=en&disable_polymer=1")
|
||||||
|
Loading…
Reference in New Issue
Block a user