diff options
| author | syeopite <syeopite@syeopite.dev> | 2021-09-03 03:33:49 -0700 |
|---|---|---|
| committer | syeopite <syeopite@syeopite.dev> | 2021-09-03 03:33:49 -0700 |
| commit | a28945273d99607b92eea1f05f57d7e1874fc20d (patch) | |
| tree | ddc892e5c8c2984a3dabd2fd5ac82938abc55a22 /src | |
| parent | fd6f03655eacdbd1dc3718017bb42793ee77fd47 (diff) | |
| download | invidious-a28945273d99607b92eea1f05f57d7e1874fc20d.tar.gz invidious-a28945273d99607b92eea1f05f57d7e1874fc20d.tar.bz2 invidious-a28945273d99607b92eea1f05f57d7e1874fc20d.zip | |
Propagate replacing yout.be links to /watch to RSS
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/comments.cr | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 6dc27639..5f607524 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -481,11 +481,15 @@ def replace_links(html) url = URI.parse(anchor["href"]) if {"www.youtube.com", "m.youtube.com", "youtu.be"}.includes?(url.host) - if url.path == "/redirect" - params = HTTP::Params.parse(url.query.not_nil!) - anchor["href"] = params["q"]? + if url.host == "youtu.be" + url = "/watch?v=#{url.request_target.lstrip('/')}" else - anchor["href"] = url.request_target + if url.path == "/redirect" + params = HTTP::Params.parse(url.query.not_nil!) + anchor["href"] = params["q"]? + else + anchor["href"] = url.request_target + end end elsif url.to_s == "#" begin |
