mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-26 08:42:08 +05:30
Catch errors in 'fetch_video' fibers
This commit is contained in:
parent
3beac53c89
commit
09cd7bcc66
@ -412,8 +412,7 @@ get "/captions/:id" do |env|
|
|||||||
begin
|
begin
|
||||||
video = get_video(id, client, PG_DB)
|
video = get_video(id, client, PG_DB)
|
||||||
rescue ex
|
rescue ex
|
||||||
error_message = ex.message
|
halt env, status_code: 403
|
||||||
next templated "error"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
env.response.content_type = "application/json"
|
env.response.content_type = "application/json"
|
||||||
|
@ -241,9 +241,6 @@ def fetch_video(id, client)
|
|||||||
if info["reason"]?
|
if info["reason"]?
|
||||||
info = client.get("/get_video_info?video_id=#{id}&ps=default&eurl=&gl=US&hl=en&disable_polymer=1").body
|
info = client.get("/get_video_info?video_id=#{id}&ps=default&eurl=&gl=US&hl=en&disable_polymer=1").body
|
||||||
info = HTTP::Params.parse(info)
|
info = HTTP::Params.parse(info)
|
||||||
if info["reason"]?
|
|
||||||
raise info["reason"]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
info_channel.send(info)
|
info_channel.send(info)
|
||||||
@ -252,6 +249,10 @@ def fetch_video(id, client)
|
|||||||
html = html_channel.receive
|
html = html_channel.receive
|
||||||
info = info_channel.receive
|
info = info_channel.receive
|
||||||
|
|
||||||
|
if info["reson"]?
|
||||||
|
raise info["reason"]
|
||||||
|
end
|
||||||
|
|
||||||
title = info["title"]
|
title = info["title"]
|
||||||
views = info["view_count"].to_i64
|
views = info["view_count"].to_i64
|
||||||
author = info["author"]
|
author = info["author"]
|
||||||
|
Loading…
Reference in New Issue
Block a user