iv-org / invidious

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

fresh Docker install: proxy not working & feed/popular and feed/top empty #1569

Closed Slinky-Wrangle-Punch closed 2 years ago

Slinky-Wrangle-Punch commented 3 years ago

I just installed invidious using Docker. I use traefik as the reverse proxy for all my docker containers. Obeying the README I set https_only: true domain: tube.mydomain.com and external_port: 443 The setup was easy and now I can watch videos on my own instance at tube.mydomain.com. But I do have two problems.

  1. The feed/popular and feed/top are empty, but the the feed/trending does show videos. I cannot find any errors in the docker logs or the browser console regarding this.

  2. If I want to proxy the videos or use dash (which uses proxy AFAIK) the videos do not play and the the banner The media could not be loaded, either because the server or network failed or because the format is not supported. occurs.

For this I found some errors in the browser console:

Any ideas what's wrong? Did I miss any configurations hints from the README?

FireMasterK commented 3 years ago

This seems to be affecting my instance (invidious.kavin.rocks) as well, the issue is that invidious adds an ?local=true to the URL, thus breaking it.

The issue was introduced 11 days ago in https://github.com/iv-org/invidious/commit/0cb442d40ece54b40da1f8415d874c18a1f7f9b5.

The problematic line is here: https://github.com/iv-org/invidious/blob/28ca5b2b57fad510ed3f877bb6662b095e3c41c1/assets/js/player.js#L46

FireMasterK commented 3 years ago

I'm don't think lines https://github.com/iv-org/invidious/blob/28ca5b2b57fad510ed3f877bb6662b095e3c41c1/assets/js/player.js#L44-L49 are necessary, I fail to understand why ?local=true is being added to /videoplayback urls.

saltycrys commented 3 years ago

The Top feed has been removed from Invidious. It relied on YouTube ratings and those are not public anymore.

The Popular feed is the latest video from the most subscribed to channels on the instance, so if there are no subscriptions the feed will be empty.

tenpura-shrimp commented 3 years ago

local=true was always there for proxy hls urls. This change just made it added in the javascript instead of forced in the html template. The actual proxied video url is exactly the same as before, which you can see in the original code: https://github.com/iv-org/invidious/pull/1552/files#diff-40d54e3a4c029ba0f4b05c01bc3e2cd7d4c0763195c34ecf17335a1a22846858L7

The previous code always had local=true in the hls use case hardcoded.

What is the actual specific error when it calls that api? Do you have some har capture or something?

tenpura-shrimp commented 3 years ago

It's also added in the hls playlist url as well https://github.com/iv-org/invidious/blob/master/src/invidious.cr#L3328

FireMasterK commented 3 years ago

The problem is that it generates broken URLs, which creates 400s.

The issue is that the string is incorrectly added.

The problem is that it creates a URL like this: /videoplayback?param=more?local=true

tenpura-shrimp commented 3 years ago

Hi,

I looked into the change and this should not be happening for /videoplayback. I tried with the latest master and did not see this issue. If you look at the original codes, for the call to hls_variant in the html template also had ?local=true.

But the videoplayback call will not have the question mark issue. The reason is that the call to the hls_playlist api already puts &local=true on the end, so the frontend javascript will not run.

for OP: It seems more like your issue is related to your CSP problem. You enabled https_only but docker doesn't provide that, so maybe your proxy config is not correct?

for FireMasterK: I tested your instance with both failfox and chrome and I was able to play a livestream at least for a short segment. (there are other reasons that livestream always breaks after a minute that are unrelated to this)

here is the request to videoplayback https://invidious.kavin.rocks/videoplayback?id=QX51zFJmqTY.1&itag=91&source=yt_live_broadcast&expire=1609153863&ei=5mjpX9rjPJTA4-EP9b-z4Ag&ip=140.238.251.76&requiressl=yes&ratebypass=yes&live=1&sgoap=gir%3Dyes%3Bitag%3D139&sgovp=gir%3Dyes%3Bitag%3D160&hls_chunk_host=r5---sn-a5meknsy.c.youtube.com&vprv=1&playlist_type=LIVE&mh=8g&mm=32&mn=sn-a5meknsy&ms=su&mv=u&mvi=5&pl=20&sc=yes&keepalive=yes&mt=1609131843&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cratebypass%2Clive%2Csgoap%2Csgovp%2Cvprv%2Cplaylist_type&sig=AOq0QJ8wRgIhALzW4nfpZVafH4C2XPS__1AQTfsygTit4grc3ERQHeufAiEAsGDujj3Ra8B2GLvpM8ImA4655vwwh6hkFPcmXS5sLyg%3D&lsparams=hls_chunk_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Csc&lsig=AG3C_xAwRgIhAKrRnR5X73m_1cyKXOml1t__omfU4CcJN7kQWzcS8CnJAiEAgBqnow66xEtJLgMiNQVkHOQhLAto56QjFSAg7R1XY-8%3D&playlist=index.m3u8&sq=7908&goap=clen%3D10041%3Blmt%3D1609124402162050&govp=clen%3D16206%3Blmt%3D1609124402162048&dur=1.000&file=seg.ts&fvip=5&local=true

FireMasterK commented 3 years ago

Take a look at this URL: https://invidious.kavin.rocks/videoplayback?expire=1609249934&ei=LuDqX4G3CoeAjuMP-o-U4Ag&ip=140.238.251.76&id=o-ALytf-acbQmOxKjqyu54jFUA6HHZ2YBIPqq9THwFhggX&itag=135&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C271%2C278%2C313&source=youtube&requiressl=yes&mh=gQ&mm=31%2C26&mn=sn-a5meknsd%2Csn-q4fl6nly&ms=au%2Conr&mv=m&mvi=5&pl=20&initcwndbps=392500&vprv=1&mime=video%2Fmp4&ns=s4fZ3KAqjwBP5axuPNtsHnIF&gir=yes&clen=5300991&dur=86.319&lmt=1609188399242000&mt=1609227883&fvip=5&keepalive=yes&c=WEB&txp=6316222&n=d2aUDxywVkaaZ-0Y&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhALj8eckJVaLnE8tXSqKs-AmJ2xYWsCmuPQNMkkz99rcFAiEAgyf38zeVqfto2d9KK-DXe-it4iZmghodrJfeY5-6lhI%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALzjzCvZcHrMV1tWh9Gm10GxiayOsUh_y1bSKAUxBfAKAiEAv8nL4jx_3XBKqeWsxVPaUQ9CX0pZBTzAYaoDOOrcKTg%3D&host=r5---sn-a5meknsd.googlevideo.com?local=true

tenpura-shrimp commented 3 years ago

I don't understand. Are you using an unusual browser or addons for this?

Can you confirm the response returned by the hls_manifest api?

FireMasterK commented 3 years ago

I don't understand. Are you using an unusual browser or addons for this?

I'm using brave nightly on windows 10, nothing that should affect this... I'm able to reproduce this even on Bromite on Android.

This bug appears to be only reproducible when logged in, I can't reproduce this in incognito.

Can you confirm the response returned by the hls_manifest api?

I'm not sure what you mean, this is a dash stream?

tenpura-shrimp commented 3 years ago

Hi,

I understand now the issue is affecting dash playback not hls streams. This did cause ?local=true to be added to the dash playback url.

But, this did not cause the issue with your instance. It appears that your server may be having poor server health for this api. If you check by using the web developer tools to retry the request with removing the ?local=true, you will see that it still fails. You can also check by rebooting your docker and likely it will work regardless of local=true after the restart.

I will still create a PR to remove this local=true in this case, because it is not necessary here, but this likely won't help your issue.

FireMasterK commented 3 years ago

When I remove ?local=true it seems to work fine, this is because URLs can't have multiple query strings.

Yes, creating a PR should fix it (unless I'm missing something).

somebody-somewhere-over-the-rainbow commented 3 years ago

I am running into the same issue as the OP. I am running an docker-compose instance on my (home) server but without any proxying (will be added once running). I am greeted with the empty page with the search bar and when I search it loads indefinitely (timeout? - docker logs do not show anything). I am not adding any CSP or anything as there is no webserver in between (calling by ip:3000). The CSP is added by invidious. However I am not sure it that is the issue...

github-actions[bot] commented 2 years 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.

SamantazFox commented 2 years ago

Is this issue still present?

unixfox commented 2 years ago

Closing due to the lack of replies.