Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Trit34 opened this issue Jun 23, 2023 · 22 comments · May be fixed by #3990
Open

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

Trit34 opened this issue Jun 23, 2023 · 22 comments · May be fixed by #3990
Labels
bug Something isn't working module:http-server HTTP (invidious users side)

Comments

@Trit34
Copy link

Trit34 commented Jun 23, 2023

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

  • Browser (if applicable): Vivaldi
  • OS (if applicable): Arch Linux
@Trit34 Trit34 added the bug Something isn't working label Jun 23, 2023
@unixfox

This comment was marked as outdated.

@unixfox unixfox closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2023
@unixfox unixfox added invalid This doesn't seem right and removed bug Something isn't working labels Jun 23, 2023
@Trit34

This comment was marked as outdated.

@unixfox
Copy link
Member

unixfox commented Jun 23, 2023

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 unixfox reopened this Jun 23, 2023
@unixfox unixfox added bug Something isn't working and removed invalid This doesn't seem right labels Jun 23, 2023
@ghost

This comment was marked as outdated.

@unixfox

This comment was marked as outdated.

@johackim

This comment was marked as duplicate.

rnek0 added a commit to rnek0/invidious that referenced this issue Jul 13, 2023
About issue : iv-org#3933

I think it should be reviewed here: https://github.com/rnek0/invidious/blob/507bed6313b49564e53b69a5c9b4d072d1e05e4b/assets/js/player.js#L40 

short_url will be used here : https://github.com/rnek0/invidious/blob/507bed6313b49564e53b69a5c9b4d072d1e05e4b/assets/js/player.js#L119

since get embedCode() a little further down returns a correct code by calling the same function on line 127

I would suggest changing this: "var short_url = location.origin + '/' + video_data.id + embed_url.search;" 
to this "var short_url = location.origin + '/watch?v=' + video_data.id + embed_url.search;"
@SamantazFox SamantazFox linked a pull request Jul 16, 2023 that will close this issue
@Yetangitu

This comment was marked as duplicate.

@rezad1393

This comment was marked as off-topic.

@ltguillaume
Copy link

ltguillaume commented Aug 15, 2023

It has to be something with the routing that's been caused by the refactoring in or around 1e25894 (pull request #3261)

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

@rezad1393
Copy link

I think this might be the issue:

1e25894#diff-b83bd9a4ffeb9402d24fe6ade99f304367e1ee03b6cd25dac08b94160b034cf0R16

Aug 10, 2022?

@ltguillaume
Copy link

ltguillaume commented Aug 15, 2023

@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
Copy link

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
Copy link
Member

unixfox commented Aug 16, 2023

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

@Trit34
Copy link
Author

Trit34 commented Aug 17, 2023

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
Copy link
Member

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.

# Check if item is video ID
if item.match(/^[a-zA-Z0-9_-]{11}$/) && YT_POOL.client &.head("/watch?v=#{item}").status_code != 404
env.response.headers["Location"] = url
haltf env, status_code: 302
end

Probably something related to this short-circuit here.

if response.body.empty?
env.response.headers["Location"] = "/"
haltf env, status_code: 302
end

@dud1337

This comment was marked as off-topic.

@rezad1393
Copy link

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

@rezad1393
Copy link

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
Copy link
Member

unixfox commented Sep 6, 2023

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
Copy link

Could you please open a separate issue for that?

done.
#4091

Copy link

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.

@github-actions github-actions bot added the stale label Sep 10, 2024
@JacksonChen666
Copy link

JacksonChen666 commented Sep 10, 2024

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

@github-actions github-actions bot removed the stale label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module:http-server HTTP (invidious users side)
Projects
None yet
Development

Successfully merging a pull request may close this issue.