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

Some Videos will not play - IP ban and/or PO token requirement resulting in 403 error on some servers #1040

Closed
f1ldg opened this issue Dec 27, 2024 · 37 comments
Labels
bug Something isn't working

Comments

@f1ldg
Copy link

f1ldg commented Dec 27, 2024

Context

Please provide any relevant information about your setup

  • Add-on Version: 7.1.1.6
    Running on Vero 4K

Expected Behavior

I run a search in the Youtube app, some videos in the search results play instantly while other videos won't play at all.
I have attached log
Thank you in advance ;-)


Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. run a search
  2. click on video
  3. video won't play
    kodi.log

Log

Please include a complete debug log.


Additional Information

Please provide any additional information that may be helpful.


@f1ldg f1ldg added the bug Something isn't working label Dec 27, 2024
@MoojMidge
Copy link
Collaborator

Not much that can be done about this at the moment. The changes that YouTube are making are still rolling out, will have to look into it further once things have settled down.

In the meantime you can try the latest beta and see if there is any improvement:
https://github.com/anxdpanic/plugin.video.youtube/releases/tag/v7.2.0%2Bbeta.2

@f1ldg
Copy link
Author

f1ldg commented Dec 28, 2024

Not much that can be done about this at the moment. The changes that YouTube are making are still rolling out, will have to look into it further once things have settled down.

In the meantime you can try the latest beta and see if there is any improvement: https://github.com/anxdpanic/plugin.video.youtube/releases/tag/v7.2.0%2Bbeta.2

Thank you for the feedback!

@f1ldg f1ldg closed this as completed Dec 28, 2024
@MoojMidge MoojMidge changed the title Some Videos will not play Some Videos will not play - IP based block resulting in 403 error on some servers Dec 29, 2024
@MoojMidge
Copy link
Collaborator

Was there any improvement using v7.2.0+beta.2?

https://github.com/anxdpanic/plugin.video.youtube/releases/tag/v7.2.0%2Bbeta.2

@MoojMidge MoojMidge reopened this Dec 29, 2024
@f1ldg
Copy link
Author

f1ldg commented Dec 29, 2024

Was there any improvement using v7.2.0+beta.2?

https://github.com/anxdpanic/plugin.video.youtube/releases/tag/v7.2.0%2Bbeta.2

Not really, I did get a couple of instances where the video would start with just sound on a green screen.
Not sure if it has anything to do with the original issue

@MoojMidge
Copy link
Collaborator

Could you get another log showing playback failing completely and only the audio playing?

I haven't been impacted by these changes yet so difficult to see exactly what is happening.

@f1ldg
Copy link
Author

f1ldg commented Dec 29, 2024

Please see attached. Thank you
kodi.log

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 29, 2024
@MoojMidge
Copy link
Collaborator

Don't think it will make a difference but can you try this test version:

https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

@MoojMidge MoojMidge changed the title Some Videos will not play - IP based block resulting in 403 error on some servers Some Videos will not play - PO token requirement resulting in 403 error on some servers Dec 29, 2024
@f1ldg
Copy link
Author

f1ldg commented Dec 29, 2024

Don't think it will make a difference but can you try this test version:

https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

I tried it with a couple of videos.
In one of them, it started well but the screen would go black after 2-3 seconds and then continue where it left off.
In the second one, the app would continually try to start the video in a non-stopping loop but would never succeed.
OS eventually froze and needed to hard-reset it.
Log attached, thank you.
kodi 2.log

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 29, 2024
MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 29, 2024
@MoojMidge
Copy link
Collaborator

Surprisingly that appears to have partially worked, but causes issues with other streams.

Updated again:
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

@f1ldg
Copy link
Author

f1ldg commented Dec 29, 2024

Using last updated version, there are 3 videos which I tested that will no play at all.
Log attached, thank you
kodi.log
On the positive side, it seems to me that other 4K videos that I was able to play seem to have run smoother than other versions.

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 30, 2024
…ultiple BaseURLs in MPD manifest anxdpanic#527 anxdpanic#1040

- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, allow ISA to try any available for playback
@MoojMidge MoojMidge changed the title Some Videos will not play - PO token requirement resulting in 403 error on some servers Some Videos will not play - IP ban and/or PO token requirement resulting in 403 error on some servers Dec 30, 2024
@MoojMidge
Copy link
Collaborator

Looks like you are (un)lucky. Seems like you are affected by both recent YouTube changes that are rolling out currently.

Another test version to try that does a combination of the two previous test versions. Not sure how well InputStream.Adaptive will handle this though.
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 30, 2024
…ultiple BaseURLs in MPD manifest anxdpanic#527 anxdpanic#1040

- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, allow ISA to try any available for playback
MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Dec 30, 2024
…ultiple BaseURLs in MPD manifest anxdpanic#527 anxdpanic#1040

- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, allow ISA to try any available for playback
@mcarni
Copy link

mcarni commented Dec 30, 2024

@MoojMidge
kodi.log

i tested the latest test version and i wanted to provide some feedback
good thing is that i can play some videos which i could not even open,
bad thing is that unfortunately i tested it with 3-4 videos and with all but one i did not get any audio

hope this helps, and thanks for your work

@f1ldg
Copy link
Author

f1ldg commented Dec 30, 2024

Looks like you are (un)lucky. Seems like you are affected by both recent YouTube changes that are rolling out currently.

Another test version to try that does a combination of the two previous test versions. Not sure how well InputStream.Adaptive will handle this though. https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

Hello there,
Just tested the latest version, unfortunately most streams will not start.
Please see attached log, thank you.
kodi.log

@MoojMidge
Copy link
Collaborator

Yes, unfortunately InputStream.Adaptive does not implement the functionality required to recover from the error resulting from the blocked request and retry using one of the alternate urls provided.

If both the audio and video streams are blocked then the video won't play.

If only the video stream is blocked but not the audio then you get the glitchy playback.

If only the audio stream is blocked but not the video then you get no audio.

Which one of these occurs depends on whether you are getting IP blocked, or whether a PO token is required, or both.

@f1ldg
Copy link
Author

f1ldg commented Dec 31, 2024

Yes, unfortunately InputStream.Adaptive does not implement the functionality required to recover from the error resulting from the blocked request and retry using one of the alternate urls provided.

If both the audio and video streams are blocked then the video won't play.

If only the video stream is blocked but not the audio then you get the glitchy playback.

If only the audio stream is blocked but not the video then you get no audio.

Which one of these occurs depends on whether you are getting IP blocked, or whether a PO token is required, or both.

I see what you mean. From what you're saying, it sounds like there isn't a workaround for it, is that correct?
Thank you for your effort in trying to resolve the issue.

@jryan15
Copy link

jryan15 commented Dec 31, 2024

Looks like you are (un)lucky. Seems like you are affected by both recent YouTube changes that are rolling out currently.

Another test version to try that does a combination of the two previous test versions. Not sure how well InputStream.Adaptive will handle this though. https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

Thanks again for all of your support. I too am having the same issue where the video starts to load for a couple of seconds and then gives up. Seems like the issue is only on newer videos. I tested the top 5 trending videos and all failed. Tested several older videos and they all still played.

@MoojMidge
Copy link
Collaborator

From what you're saying, it sounds like there isn't a workaround for it, is that correct?

There will always be a way, but it may not be easy or practical for the end user. Any way forward will require time, which I don't have anymore.

This was a low effort attempt. There are 3 more things to try, but I will likely only have time to try the first option:

  1. Proxy the stream requests to manage the errors and retry using alternate urls so that InputStream.Adaptive doesnt fall over trying to handle the errors
    • the alternate urls may or may not work
  2. Implement a means to use web based player requests
    • won't work if an IP ban is in place.
  3. Implement a means to use PO tokens for player requests
    • won't work if an IP ban is in place.

I too am having the same issue where the video starts to load for a couple of seconds and then gives up. Seems like the issue is only on newer videos. I tested the top 5 trending videos and all failed. Tested several older videos and they all still played.

Can you post a debug log of a video that doesn't play, and one that does?

@jryan15
Copy link

jryan15 commented Jan 2, 2025

Hi again, thanks for taking the time to help on this. Please let me know if there is some way that I can financially support your effort as I am truly appreciative :-).

I tested 3 or 4 videos that did not work at the bottom of the log file and following that I clicked on a couple wrestling videos that did work ok. Those should be the very last entries.

https://paste.kodi.tv/wawujovuyu

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 3, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
@MoojMidge
Copy link
Collaborator

Proxy the stream requests to manage the errors and retry using alternate urls so that InputStream.Adaptive doesnt fall over trying to handle the errors

  • the alternate urls may or may not work

@f1ldg, @mcarni - can you try this test version, which implements a stream proxy in the addon:
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

This will determine whether any of the alternate urls will work or not.

@jryan15 - your log is not a debug so I can't see all the relevant details, but there are a couple of interesting issues that have been logged:

  • The http server is not starting because it is being prevented from doing so:
    • Try running the followng command in Powershell (this will trigger a User Account Control dialog requesting admin rights to execute)
    • Start-Process powershell -Verb runAs -ArgumentList "net stop winnat; net start winnat"
    • Then run the Setup Wizard and apply the recommended settings in Step 1 of the wizard. This may allow the http server to run correctly, otherwise you will need to have a look at your network and firewall setup, which may be causing this.
  • Because the http server is not running, the addon is attempting to use the HLS manifests, but failing because these are being blocked. These had previously been working, so it appears that whatever changes YouTube are making are still ongoing

Please let me know if there is some way that I can financially support your effort as I am truly appreciative :-).

The thought is much appreciated. I don't require any financial support but you can certainly show your support by donating to Kodi if you like: https://kodi.tv/donate/

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 3, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
@mcarni
Copy link

mcarni commented Jan 3, 2025

Proxy the stream requests to manage the errors and retry using alternate urls so that InputStream.Adaptive doesnt fall over trying to handle the errors

  • the alternate urls may or may not work

@f1ldg, @mcarni - can you try this test version, which implements a stream proxy in the addon: https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

This will determine whether any of the alternate urls will work or not.

@MoojMidge , first of all, thanks, this is really appreciated, being able to wathc youtube is kind of the heart of our kodi experience, we really appreciate your effort and the team's effort.

i installed the latest versions and it shows some improvements.
it is quite awkward to me, but hopefully it makes some sense to you.
Once installed, i reset the addon settings(excluging the wizard...) to the defaults and i tried to play the same video that yesterday had no audio.
I still had no audio but i remembered that yesterday i have been playing with settings and i switched the "quality settings" in the addon from "quality + performance" to "ASK + quality + ..."
when i retried to play the same video i got the window with the different options, i tried the first one (I am assuming the highest quality) and it worked, i had video and audio
as mentioned, it seemed strange to me, so i tried to switch back the setting a couple of times and indeed it seemed to work (also using a different yt frontend = ytchannels addon)
Unfortunately it doesn't work 100%, I then tried two more videos and in one case i tried to switch to all available streams but not could work, in the second case, i did exaclty the same (chosen the first stream) and it worked.

If there is anything i can do, please let me know, my coding skills are not the best (my son is much better than me with python ;) ), but i can try to help...
I also tried to play with yt-dlp and mpv (I am running kodi from a raspberrypi4 with raspberrypios/debian installed as OS) and i get 403 messages.

thanks a lot

M
kodi.log

@f1ldg
Copy link
Author

f1ldg commented Jan 3, 2025

Good morning and happy new year!
Just tried the new version, didn't work very well for me. Some streams would not load and some would make the Vero 4k crash. Please see attached log, many thanks!!!
kodi.log

@jryan15
Copy link

jryan15 commented Jan 3, 2025

  • reviously been w

Hi again. I ran the powershell routine and re-ran the setup routine. When using the recommended values, it cycled through 13 attempts to connect the http server before saying it failed to connect. I am not sure what I need to open up in the firewall to allow the http server to connect. If you could kindly point me in a direction, that would be great!

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 4, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
@MoojMidge
Copy link
Collaborator

Updated test version:
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

I can't test any of this, so I can only make changes based on what is shown in your logs, but it does appear to be working. Don't know if it will continue to work though.

Note as well that it will only work if MPEG-DASH is enabled and being used (the first option in the selection dialog when "Ask for quality" is enabled), so ensure that the Setup Wizard is run and at least the first two steps are completed.

If you come across a video that doesn't work then try and get a log just for that video please.

I am not sure what I need to open up in the firewall to allow the http server to connect

Not sure what firewall you are using, but you need to enable connections or allow opening ports for Kodi on your local or private network. Unfortunately I am very pressed for time, so can't help much more than that. It is not a common problem, so you will need to do a bit of research to figure out what is going on with your system and how it has been configured.

@f1ldg
Copy link
Author

f1ldg commented Jan 5, 2025

Just tested the latest test version after running the setup wizard.
"Ask for quality" enabled and initially all resolutions available for choice in the list. Upon choosing 4K resolution, stream would not start.
Tried Adaptive HLS option and stream would start in lower resolution (1920x1080) but sometimes with no sound, only video.
Strangely after playing a video in lower resolution and trying a different stream, no longer 4K streaming options became available on the list. Only choices available are "Adaptive HLS" and "HLS".
kodi.log
I hope my description above is clear enough... Log attached and thank you again ;-)

@noirrak
Copy link

noirrak commented Jan 5, 2025

Just tested the latest test version after running the setup wizard. "Ask for quality" enabled and initially all resolutions available for choice in the list. Upon choosing 4K resolution, stream would not start. Tried Adaptive HLS option and stream would start in lower resolution (1920x1080) but sometimes with no sound, only video. Strangely after playing a video in lower resolution and trying a different stream, no longer 4K streaming options became available on the list. Only choices available are "Adaptive HLS" and "HLS". kodi.log I hope my description above is clear enough... Log attached and thank you again ;-)

Yes, I have exactly the same problems.

@GladistonXD
Copy link

Same here, they only work at resolutions up to 1080p with MPEG-DASH disabled.

@MoojMidge
Copy link
Collaborator

Note as well that it will only work if MPEG-DASH is enabled and being used (the first option in the selection dialog when "Ask for quality" is enabled)

As mentioned previously this workaround will only work when using MPEG-DASH. Use of any other playback option will simply result in the block being applied according to whatever criteria YouTube have determined.

The issue that @f1ldg has is that the http server is not working correctly so MPEG-DASH playback will therefore fail. I dont know why this would occur and can't replicate it, but if you are having the same problem and want to see it fixed then provide a debug log so I can see what you may all have in common.

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 7, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
@MoojMidge
Copy link
Collaborator

@f1ldg - can you try updated test version:
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

Make sure to run the Setup Wizard too (at least the first step).

@f1ldg
Copy link
Author

f1ldg commented Jan 7, 2025

@MoojMidge
Hello again,
Tried again after running setup wizard.
This time only "HLS" and "Adaptive HLS" appeared on the options list, never a 4k resolution option.
Even when choosing one of these lower resolution options sometimes the stream wouldn't play.
Log attached, thanks!!!
kodi.log

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 7, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
@MoojMidge
Copy link
Collaborator

This time only "HLS" and "Adaptive HLS" appeared on the options list, never a 4k resolution option.
Even when choosing one of these lower resolution options sometimes the stream wouldn't play.

These will likely never work properly if your IP is being blocked. As mentioned previously the workaround will only work if using MPEG-DASH, but this can't be used if the http server is not working.

See if this works: https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

@f1ldg
Copy link
Author

f1ldg commented Jan 7, 2025

@MoojMidge
Hi again.
On the first stream I played all resolutions including 4K were available.
Upon playing 4K, video and audio mostly good, but video a bit glitchy freezing every 5 seconds or so.
Once I stopped the video I noticed that a message popped up on screen "[Errno 98] Address already in use"
After that I tried playing other streams and 4K resolution option no longer available, only "HLS" and "Adaptive HLS".

I then disabled the Youtube app and enabled it again.
Once again the 4k option became available but this time video was frozen and audio kept playing in the background.

Log attached, many thanks!!!
kodi.log

MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 9, 2025
- ISA doesn't support Representations with multiple BaseURLs
- Dont block adaptive formats for clients that may need PO tokens
- Some urls for adaptive formats may be blocked even if client does need a PO token
- As not all urls may be blocked, use HTTPServer to try them all as a proxy to ISA
MoojMidge added a commit to MoojMidge/plugin.video.youtube that referenced this issue Jan 9, 2025
- As headers are not matched this can lead to detection of Kodi being used as a client
@MoojMidge
Copy link
Collaborator

Leaving aside the "Address already in use" issue, the problem appears to be that your device and internet connection are not fast enough to be proxying these 4k video streams.

Bitrate is approaching 40 Mb/s for the video at times but your average download speed is around 30 Mb/s. Reading and writing that data to memory is also causing issues with your device not being able to keep up.

Using new test version, try the following:
https://github.com/MoojMidge/plugin.video.youtube/archive/refs/heads/master.zip

  1. Try reducing the video quality to 1440p or 1080p.
  2. Try enabling Settings > Advanced > HTTP Server > Stream redirect

@f1ldg
Copy link
Author

f1ldg commented Jan 9, 2025

@MoojMidge
I understand your point, but I don't think the internet connection or the device (Vero 4K) is the issue here.

I just tested my internet speed, and it's close to 100 Mb/s. Additionally, the same videos play flawlessly on the native YouTube app installed on a smart TV connected to the same network.

As for the Vero 4K, it should be more than capable of handling these video streams.

This leads me to believe the problem might be with Kodi itself. I'm seriously considering factory resetting the box and starting from scratch to see if that resolves the issue. What do you think? Thanks once again!

Screenshot 2025-01-09 at 10 37 18 AM

@MoojMidge
Copy link
Collaborator

I just tested my internet speed, and it's close to 100 Mb/s.

Can you run a speed check from this actual device? The download speed reported by InputStream.Adaptive is capping out at well below that.

As for the Vero 4K, it should be more than capable of handling these video streams.

Normally, yes, but this workaround is now requiring your device to be doing extra work that wouldn't normally occur when playing the video normally. So while a lot of the work would have been offloaded and hardware accelerated by various parts of your device SoC, now there will be additional CPU bound and system memory bound operations required.

Anyway see how you go with that latest test version and a 4k stream. Then if there are still issues try the steps I mentioned.

The main thing I am trying to determine is whether this method is effective in resolving the blocks. If it is, then there are other ways that this could be implemented.

@f1ldg
Copy link
Author

f1ldg commented Jan 9, 2025

@MoojMidge

Regarding the speed test, you're right. I just installed the Speed Tester add-on on the Vero 4K, and it shows a speed of only 40 Mb/s. I'll work on resolving that.

I’ve also been testing your new YouTube version. Initially, I tried streaming in 4K, which worked but was glitchy—likely due to the internet speed (??)

Next, I lowered the resolution to 1080p and enabled the "stream redirect" option. The result was almost flawless... However, I noticed that streams usually start without audio. To fix this, I scroll back 10 seconds while the video is playing, and the audio syncs correctly.

Log attached, many thanks!

kodi.log

@MoojMidge
Copy link
Collaborator

I wouldn't use the Stream redirect option unless absolutely necessary.

The "Address already in use" issue can be avoided by disabling Settings > Advanced > HTTP Server > Allow idle shutdown

Apart from that the main issue in your log is simply that the download speed is too low for the 4k streams.

The original problem I would now consider to be resolved.

@f1ldg
Copy link
Author

f1ldg commented Jan 9, 2025

Brilliant, thank you very much!!!! Much appreciated! ;-)

@f1ldg f1ldg closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants