diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-22 11:17:29 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-22 11:17:29 -0500 |
| commit | 09cd7bcc6618693ce64ce4a4d7695328ea362b54 (patch) | |
| tree | 5835e75a2d52e94d7bd76113c15bcc6135a41404 | |
| parent | 3beac53c892222f542124eeb3083882335b9d6bb (diff) | |
| download | invidious-09cd7bcc6618693ce64ce4a4d7695328ea362b54.tar.gz invidious-09cd7bcc6618693ce64ce4a4d7695328ea362b54.tar.bz2 invidious-09cd7bcc6618693ce64ce4a4d7695328ea362b54.zip | |
Catch errors in 'fetch_video' fibers
| -rw-r--r-- | src/invidious.cr | 3 | ||||
| -rw-r--r-- | src/invidious/helpers.cr | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 5234fe00..be05bc20 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -412,8 +412,7 @@ get "/captions/:id" do |env| begin video = get_video(id, client, PG_DB) rescue ex - error_message = ex.message - next templated "error" + halt env, status_code: 403 end env.response.content_type = "application/json" diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 3388c023..4523ab81 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -241,9 +241,6 @@ def fetch_video(id, client) if info["reason"]? 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) - if info["reason"]? - raise info["reason"] - end end info_channel.send(info) @@ -252,6 +249,10 @@ def fetch_video(id, client) html = html_channel.receive info = info_channel.receive + if info["reson"]? + raise info["reason"] + end + title = info["title"] views = info["view_count"].to_i64 author = info["author"] |
