iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.37k stars 1.83k forks source link

[Bug] Redirect from short youtu.be URLs does not work #3933

Open Trit34 opened 1 year ago

Trit34 commented 1 year ago

Describe the bug youtu.be/××××× short URLs are usually converted as [Invidious]/××××× and they used to be redirected to the full URLs [Invidious]/watch?v=×××××. As of today (but I don’t know since when exactly), it does not work anymore and such shortened URLs lead to the homepage of the instance instead.

Steps to Reproduce Tested on FDN’s Invidious instance (updated each Sunday):

  1. Go to https://invidious.fdn.fr/yWsS5UJf8yU (for example)
  2. Instead of redirecting to https://invidious.fdn.fr/watch?v=yWsS5UJf8yU, it loads https://invidious.fdn.fr/feed/popular, the homepage.

Additional context

unixfox commented 1 year ago

Closing as it works fine on instances that are officially published on https://instances.invidious.io

Trit34 commented 1 year ago

Closing as it works fine on instances that are officially published on https://instances.invidious.io

Not all of them, then: it works with yewtu.be (last updated on 11th June), but not with https://yt.artemislena.eu/, nor https://invidious.projectsegfau.lt/ (both last updated to 21st June, and both are instances on this list).

Maybe you don’t want to hear about it anymore since it (still?) works on the instances you tested with (and it’s good to hear, but how long will it last for them?), but I wonder if there was a commit that break this redirect (since it seems to affect only instances updated circa after mid-June), and I’m not a programmer. Luckily, it’s a minor (but annoying) bug, but I guess that if other people notice it on their side, they will report it too.

unixfox commented 1 year ago

Reopening as I can reproduce the issue on the test instance: https://test.invidious.io/yWsS5UJf8yU

I did close the issue before because it was working on an up to date instance: https://vid.puffyan.us/yWsS5UJf8yU

ghost commented 1 year ago

Yes, there is indeed such a problem with some instances. For example, on the yt.artemislena.eu instance, any attempt to enter a short video ID (example https://yt.artemislena.eu/kwrKVY72iSk) only results in a redirect to the site root. There are suspicions that this is due to some kind of incorrect web server settings, but I don’t know with which ones.

unixfox commented 1 year ago

There are suspicions that this is due to some kind of incorrect web server settings, but I don’t know with which ones.

No I don't think it's that. It used to work in the past and invidious never required any special configuration.

It could be that youtube is doing some A/B testing and an endpoint that we are using for detecting short URLs doesn't work anymore.

johackim commented 1 year ago

I have this bug too.

I use this invidious configuration on my instance https://invidious.ethibox.fr.

The format https://invidious.ethibox.fr/watch?v=fmsoym8I-3o works correctly.

But when I try to access a YouTube video with the https://invidious.ethibox.fr/fmsoym8I-3o format, it doen't work, it redirects to the homepage.

Yetangitu commented 1 year ago

"Me Too" - the same problem has been plaguing my instance for a while now, it is unclear when exactly it started. Turn on debug logging and the following shows when trying to view an affected video (using https://youtu.be/5Ge2RcvDlgw to test):

2023-07-31 22:26:09 UTC [info] 302 GET /5Ge2RcvDlgw 57.15ms
2023-07-31 22:26:09 UTC [info] 200 GET / 310.29µs

That's it, no more.

rezad1393 commented 1 year ago

There are suspicions that this is due to some kind of incorrect web server settings, but I don’t know with which ones.

No I don't think it's that. It used to work in the past and invidious never required any special configuration.

It could be that youtube is doing some A/B testing and an endpoint that we are using for detecting short URLs doesn't work anymore.

I dont know if it is the addon https://github.com/libredirect/browser_extension/issues/763 or invidious. but I don't think it is youtube. and my guess is invidious is as fault here. when I use that addon and use piped it redirects correctly.

in my history I see redirect from https://youtu.be/q9t8TRxEjus to https://invidious.projectsegfau.lt/q9t8TRxEjus and that goes to https://invidious.projectsegfau.lt/feed/popular.

if I do https://www.youtube.com/q9t8TRxEjus I on youtube get a

This page isn't available. Sorry about that.
Try searching for something else.
ltguillaume commented 1 year ago

It has to be something with the routing that's been caused by the refactoring in or around https://github.com/iv-org/invidious/commit/1e25894f7ec37044698f9fddf60813e0199b921b (pull request https://github.com/iv-org/invidious/pull/3261)

Maybe this is triggered while it shouldn't since the refactoring?

rezad1393 commented 1 year ago

I think this might be the issue:

1e25894#diff-b83bd9a4ffeb9402d24fe6ade99f304367e1ee03b6cd25dac08b94160b034cf0R16

Aug 10, 2022?

ltguillaume commented 1 year ago

@rezad1393 It's been around for a while now, certainly longer than the existence of this issue, and quite a few instances take a long time to update, so that would have delayed the introduction of the bug.

selurvedu commented 1 year ago

Reopening as I can reproduce the issue on the test instance: https://test.invidious.io/yWsS5UJf8yU

I did close the issue before because it was working on an up to date instance: https://vid.puffyan.us/yWsS5UJf8yU

@unixfox while this example works on vid.puffyan.us, it doesn't work for e.g. https://vid.puffyan.us/dQw4w9WgXcQ. Instead of redirecting to https://vid.puffyan.us/watch?v=dQw4w9WgXcQ, it redirects to some random channel (https://vid.puffyan.us/channel/UCoG6BrhgmivrkcbEHcYtK4Q). Some other instances, including yewtu.be, redirect to the front page.

unixfox commented 1 year ago

It's a known problem, it's on the track list of issues to solve.

Trit34 commented 1 year ago

Well, for now, you can copy the video ID, open a random video after being redirected to the front page and replace its video ID by yours to go to the video you want to see. It takes just seconds…

syeopite commented 1 year ago

Wasn't the consensus back in #2347 that youtu.be links should be handled by external redirect programs? Did the consensus change since then?


Anyways, seems like there is logic pertaining to redirect youtu.be video ids within the 404 handler. Weird that its never triggered.

https://github.com/iv-org/invidious/blob/34508966027fce3f460d9670eeecef67b92565a0/src/invidious/routes/errors.cr#L37-L41

Probably something related to this short-circuit here.

https://github.com/iv-org/invidious/blob/34508966027fce3f460d9670eeecef67b92565a0/src/invidious/routes/errors.cr#L13-L16

dud1337 commented 1 year ago

Adding that the share button gives short URLs. As they fail, it prevents users from easily to an invidious instance with a timestamp. Of course, one could still manually modify a link, but that seems like pre-industrial revolution-level toil. Love the project! image

rezad1393 commented 1 year ago

these are also not correctly redirected? https://youtube.com/live/video-id like: https://youtube.com/live/ZPnlpbymGZc

rezad1393 commented 1 year ago

many of youtube redirections that work with piped, don't work with invidious. like this https://www.youtube.com/channel/UCaB9TDPxm_dpNx6sDpZTuzg/featured because it have /features at the end, it goes to homepage of instance and not even the channel page.

unixfox commented 1 year ago

many of youtube redirections that work with piped, don't work with invidious. like this https://www.youtube.com/channel/UCaB9TDPxm_dpNx6sDpZTuzg/featured because it have /features at the end, it goes to homepage of instance and not even the channel page.

This is a separate issue, this is because we do not support this functionality called "featured".

Could you please open a separate issue for that?

rezad1393 commented 1 year ago

Could you please open a separate issue for that?

done. https://github.com/iv-org/invidious/issues/4091

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.

JacksonChen666 commented 1 month ago

Applicable on 2024.08.26-4782a67 (no modified source code link). Bugs don't fix themselves.