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

Video plays in browser but gets 403 via API #3503

Closed
forthrin opened this issue Dec 18, 2022 · 1 comment
Closed

Video plays in browser but gets 403 via API #3503

forthrin opened this issue Dec 18, 2022 · 1 comment
Labels
question Further information is requested

Comments

@forthrin
Copy link

Describe the bug

Browsed through similar 403 issues here, but can't figure out what is the core issue or how to resolve this.

Works fine when getting directly from YouTube using this technique.

Steps to Reproduce

https://invidious.weblibre.org/watch?v=GA7Kl7XWOmM plays fine in browser, but fails through API:

$ ffmpeg -i $(curl 'https:/invidious.weblibre.org/api/v1/videos/GA7Kl7XWOmM' | jq -r '.formatStreams[-1].url') -c copy foo.mp4
HTTP error 403 Forbidden

By comparison, a video like dP4kXJ92Qh4 works fine via the API.

Additional context

macOS 12.6
ffmpeg git-2022-06-01-c6364b71 
@forthrin forthrin added the bug Something isn't working label Dec 18, 2022
@unixfox
Copy link
Member

unixfox commented Dec 18, 2022

This video GA7Kl7XWOmM is an encrypted content that can only be loaded from the same IP address as the one that generated the request for getting the content. In this case, only the server invidious.weblibre.org can load the content.

So you need to proxy the content through the invidious instance in order to have the video working.

You can easily do that with the special endpoint /latest_version like this: https://invidious.weblibre.org/latest_version?id=GA7Kl7XWOmM&itag=22&local=true

The parameter local=true means proxying the content through the invidious instance. itag is the video quality, you can find the video quality in the same API endpoint that you used or look at the source code of invidious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants