diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-09-06 16:45:15 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-09-06 16:45:15 -0500 |
| commit | cf63c825d4e0b34d9b07c12d468ff9be2596d740 (patch) | |
| tree | 49f758a03b95edebc1363de457df18bf24f31ed4 /src/invidious.cr | |
| parent | 446d8569a405dbc4529540c937736f8da9bfbc74 (diff) | |
| download | invidious-cf63c825d4e0b34d9b07c12d468ff9be2596d740.tar.gz invidious-cf63c825d4e0b34d9b07c12d468ff9be2596d740.tar.bz2 invidious-cf63c825d4e0b34d9b07c12d468ff9be2596d740.zip | |
Add fix for shortened youtu.be links in comments
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index ebd1b76a..58525f26 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1816,6 +1816,7 @@ get "/api/v1/comments/:id" do |env| body = html.body session_token = body.match(/'XSRF_TOKEN': "(?<session_token>[A-Za-z0-9\_\-\=]+)"/).not_nil!["session_token"] ctoken = body.match(/'COMMENTS_TOKEN': "(?<ctoken>[^"]+)"/) + if !ctoken env.response.content_type = "application/json" @@ -1909,7 +1910,10 @@ get "/api/v1/comments/:id" do |env| url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s if url url = URI.parse(url) + + if url.path == "/redirect" url = HTTP::Params.parse(url.query.not_nil!)["q"] + end else url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s end |
