mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add fix for shortened youtu.be links in comments
This commit is contained in:
parent
446d8569a4
commit
cf63c825d4
1 changed files with 4 additions and 0 deletions
|
@ -1816,6 +1816,7 @@ get "/api/v1/comments/:id" do |env|
|
||||||
body = html.body
|
body = html.body
|
||||||
session_token = body.match(/'XSRF_TOKEN': "(?<session_token>[A-Za-z0-9\_\-\=]+)"/).not_nil!["session_token"]
|
session_token = body.match(/'XSRF_TOKEN': "(?<session_token>[A-Za-z0-9\_\-\=]+)"/).not_nil!["session_token"]
|
||||||
ctoken = body.match(/'COMMENTS_TOKEN': "(?<ctoken>[^"]+)"/)
|
ctoken = body.match(/'COMMENTS_TOKEN': "(?<ctoken>[^"]+)"/)
|
||||||
|
|
||||||
if !ctoken
|
if !ctoken
|
||||||
env.response.content_type = "application/json"
|
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
|
url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
|
||||||
if url
|
if url
|
||||||
url = URI.parse(url)
|
url = URI.parse(url)
|
||||||
|
|
||||||
|
if url.path == "/redirect"
|
||||||
url = HTTP::Params.parse(url.query.not_nil!)["q"]
|
url = HTTP::Params.parse(url.query.not_nil!)["q"]
|
||||||
|
end
|
||||||
else
|
else
|
||||||
url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
|
url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue