Kodi Community Forum

Full Version: YouTube
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, it looks like a figured out a solution for the "The following content is not available on this app." error which lets you stay on a stable add-on release. You still have to disable MPEG-DASH for now, but I think this is a separate issue since it affects all the alpha versions as well and I can't see the add-on team releasing two alpha versions with this problem if it was was happening to them at release time. About 2 months ago I saw the same MPEG-DASH problem pop up for a couple of days but then it just went away by itself. I suspect if we are patient it will resolve itself this time too but in the meantime we just have to be patient for a while.

A little while back some people were saying to edit video_info.py to change the Android client info to send to YouTube, but nobody seemed sure what to change it to. When I tested the 6.8.26.Alpha1 version (and Alpha2) the "not available" error was gone and it occurred to me that it might be possible to retro-fit the Android client version fix in 6.8.26.Alpha1 or Alpha2 into the last stable add version (I'm using 6.8.25 Unofficial). I found the new code and pasted it over the old code and it seems to work perfectly (except for the MPEG-DASH issue). These instructions are for 6.8.2.25 but they should work for the latest stable 7.x release too.

First with a stable version of the add-on installed open video_input.py and find the block of code which looks like this (somewhere around line 742)...

        payload = {'videoId': video_id,
            'context': {'client': {'clientVersion': '16.49', 'gl': self.region,
            'clientName': 'ANDROID', 'hl': self.language}},
            'thirdParty': {'embedUrl': 'https://google.com'}
        }


...and completely replace it with this code from the alpha versions...

        ANDROID_APP_VERSION = '18.14.41'
        headers['User-Agent'] = 'com.google.android.youtube/%s ' \
                                '(Linux; U; Android 12; US) gzip' % ANDROID_APP_VERSION
        payload = {'videoId': video_id,
                   'contentCheckOk': True,
                   'racyCheckOk': True,
                   'context': {'client': {'clientVersion': ANDROID_APP_VERSION,
                                          'clientName': 'ANDROID',
                                          'gl': self.region,
                                          'hl': self.language,
                                          'androidSdkVersion': 31,
                                          'osName': 'Android',
                                          'osVersion': '12',
                                          'platform': 'MOBILE'}},
                   }


I restarted Kodi for good measure but you probably don't need to. I've tested this on my FireTV and Windows 10 installations and it works on both. Now I just have to wait for MPEG-DASH to start working properly again.
Thank you so much for this.  I have it working again now.

Just one minor edit though the file is called video_info.py
Any fix that will work for 18.7 Leia? 

Jomjom79
(2023-04-27, 19:33)jomjom79 Wrote: [ -> ]Any fix that will work for 18.7 Leia? 

Jomjom79

I mean 6.8.25 running under Leia

Jomjom79
I can't see why not.  Probably worth taking a backup copy of the file first just in case
Where exactly is this file located? Cant seem to find it anywhere..

jomjom79
Since Kodi was updated to Matrix (And thus Libreelec after version 10), i have been having issues with all the live streams, including youtube streams or any video that needs to buffer at some point. What happens is that as the video starts to buffer (the video pauses and i can see the buffering circle in the middle of the screen) and finishes buffering, the last video frame stays frozen on screen and only the audio continues to play after the buffering. The only way to fix this is to stop and restart the video.

I am on  a Raspberry Pi, and this happens on both the latest Kodi which was relesed for RPI (19.4) and Libreelec (all versions after 10, including the nightlies, i have tried them all).

Is anybody having similar issues as me? I have seen several bug reports and forum posts in regard to the very same issue so i am pretty sure i am not the only one here. Something got broken during the update from Leia to Matrix.
(2023-04-27, 19:23)davidjm Wrote: [ -> ]Thank you so much for this.  I have it working again now.

Just one minor edit though the file is called video_info.py

My bad... fixed.
That's video_info.py for Kodi Leia (checked on 18.9). Download it and replace existing file in addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper folder. Reboot device (just restart Kodi isn't enough) and You're back in business, including MPEG-DASH with 1080 support
(2023-04-27, 20:01)jomjom79 Wrote: [ -> ]Where exactly is this file located? Cant seem to find it anywhere..

jomjom79

addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper/video_info.py
(2023-04-27, 22:30)StrangeAlien Wrote: [ -> ]That's video_info.py for Kodi Leia (checked on 18.9). Download it and replace existing file in addons/plugin.video.youtube/resources/lib/youtube_plugin/youtube/helper folder. Reboot device (just restart Kodi isn't enough) and You're back in business, including MPEG-DASH with 1080 support

Is this solution only for Leia? 🤔

I do have similar YouTube problems on *both* my AlexElec 3.3.5 S9xxDual ( Leia) build, and also for AlexElec CE 03 Kodi 20.1 build, both working on x96mini ( S905W, 2/16GB) tv box.

( alexelec.tv is a Coreelec fork.)
It should work on Python 3 (Kodi Matrix and up), I suppose, but I'm not 100% sure, because I didn't test it. Just back up original file as, say, video_info.py.bak and try use my one. You can return to original setup at any time simply by restore backed up file
(2023-04-27, 23:37)StrangeAlien Wrote: [ -> ]It should work on Python 3 (Kodi Matrix and up), I suppose, but I'm not 100% sure, because I didn't test it. Just back up original file as, say, video_info.py.bak and try use my one. You can return to original setup at any time simply by restore backed up file

Ok thanks 👍
(2023-04-27, 18:50)arsMOBILIS Wrote: [ -> ]Ok, it looks like a figured out a solution for the "The following content is not available on this app." error

I tried your solution on Nexus/Omega with MPEG-Dash disabled and indeed video works again albeit at low resolution. However, there still seem to be regular audio dropouts every minute or so.
Also, once a video has been played, Kodi will not shut down properly but hangs... possibly due to an inablitiy to terminate that running process.
I found the 6.8.26 worked for me on Nexus, but the 7.0.2 had buffering problems. Go figure, I guess it will be sorted really quick before it's added to the repository. Looks like a Win!