Dis90 / plugin.video.discoveryplus

discovery+ add-on for Kodi
65 stars 13 forks source link

Error loading cookies.txt? #68

Closed lockyt closed 2 years ago

lockyt commented 2 years ago

Hi I am getting the following error when I go to run discovery+ addon. I was working fine yesterday.

2021-12-19 01:25:36.002 T:1469006720   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: [Errno 2] No such file or directory: '/storage/.kodi/userdata/addon_data/plugin.video.discoveryplus/realm_config'
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.discoveryplus/addon.py", line 14, in <module>
                                                helper = KodiHelper(base_url, handle)
                                              File "/storage/.kodi/addons/plugin.video.discoveryplus/resources/lib/kodihelper.py", line 37, in __init__
                                                self.get_setting('cookiestxt_file'), self.get_setting('cookie'), self.get_setting('us_uhd'))
                                              File "/storage/.kodi/addons/plugin.video.discoveryplus/resources/lib/dplay.py", line 48, in __init__
                                                realm_config    = self.load_realm_config()
                                              File "/storage/.kodi/addons/plugin.video.discoveryplus/resources/lib/dplay.py", line 189, in load_realm_config
                                                f = open(config_file, "r")
                                            IOError: [Errno 2] No such file or directory: '/storage/.kodi/userdata/addon_data/plugin.video.discoveryplus/realm_config'
                                            -->End of Python script error report<--

I have checked the cookies.txt and it is there and permissions seem fine. I have also created a new cookies.txt (after a new login into the website on chrome) and put that in place, but still no dice. I also installed a brand new copy of LibreELEC and newly installed discovery+ add-on but still same error. (I used the same version of both LibreElec and Discovery+ from my downloads that I originally used).

Any ideas on what I am doing wrong?

Dis90 commented 2 years ago

Try restart Kodi. It reports that realm_config file is missing and add-on should download it on startup of Kodi. But atleast when add-on is updated it doesn’t run service for downloading realm config. I need to fix that. Please let me know if that fixes the problem.

lockyt commented 2 years ago

Yes have tried rebooting Kodi a few times - makes no difference. Also tried removing discovery+ and your repository and added all back - same problem.

What is realm_config part of - maybe I can add that dependency manually?

lockyt commented 2 years ago

I had cookies.txt on a USB stick and that is where it reads it from - worked fine but this morning I booted and tried running discovery+ without it plugged in - maybe that is what caused the problem?

USB plugged in now. Have also tried copying it to the filesystem and pointing discovery+ to there - same issue however.

Dis90 commented 2 years ago

It is hard to explain what exactly is needed but if you know how Chrome devtools work you can open discoveryplus.com and look for url https://prod-realmservice.mercury.dnitv.com/realm-config/ and save contents of that to addon_data/plugin.video.discoveryplus/realm_config. You can’t go directly to that address because it is missing your country specific url to d+. Well if you are from USA it is easy just add www.discoveryplus.com to end of url.

Dis90 commented 2 years ago

Actually main problem can be missing settings folder. Do you have folder addon_data/plugin.video.discoveryplus? Of not try to create it and hopefully that fixes the problem.

lockyt commented 2 years ago

Just checked and that directory exists - it has a file called settings.xml in there.

lockyt commented 2 years ago

by the way, I did a spot check on the files that are being referenced in the error - all I checked so far are there

lockyt commented 2 years ago

Although I can't see /storage/.kodi/userdata/addon_data/plugin.video.discoveryplus/realm_config

lockyt commented 2 years ago

It is hard to explain what exactly is needed but if you know how Chrome devtools work you can open discoveryplus.com and look for url https://prod-realmservice.mercury.dnitv.com/realm-config/ and save contents of that to addon_data/plugin.video.discoveryplus/realm_config. You can’t go directly to that address because it is missing your country specific url to d+. Well if you are from USA it is easy just add www.discoveryplus.com to end of url.

I'm in Australia. I will see if I can find the url you mention - any particular section of Dev tools?

Dis90 commented 2 years ago

Network tab and refresh page after opening it

Dis90 commented 2 years ago

I just tried to go Australian d+ and website says: Soon…But Not Quite Yet discovery+ is not yet available in this location.

We can’t wait to bring discovery+ to your part of the world!

So are you using VPN or what is going on?

lockyt commented 2 years ago

Sorry yes, using a VPN - should have explained that. VPN through to UK.

lockyt commented 2 years ago

Being a bit dim.

lockyt commented 2 years ago

Ok found that section - which bit do I save to realm_config?

lockyt commented 2 years ago

Just the full URL with the bit on the end?

lockyt commented 2 years ago

Ok so I guess I paste that URL into the browser and copy the response into realm_config in that directory? If so, just tried that and didn't work.

Dis90 commented 2 years ago

Can you post contents of realm config? I'm starting to think this is something to do with VPN.

lockyt commented 2 years ago

{"environment":"prod","authDomain":"auth.discoveryplus.com/gb","domain":"eu1-prod-direct.discoveryplus.com","brandId":"dplus","realm":"dplay","pathRegex":"www\.discoveryplus\.com\/gb($|\/.*)","mainTerritoryCode":"gb","siteLookupKey":"dplus_uk"}

lockyt commented 2 years ago

I think I got it working - got past the error - realised I create realm_config in /storage/.kodi/addons/plugin.video.discoveryplus not /storage/.kodi/userdata/addon_data/plugin.video.discoveryplus/realm_config

I have fixed now - but it asked to install waveline or something like that to watch the video file. Asked if I wanted to install where I said yes. It then said I need chrome OS recovery image to work which it is now doing but it is 1gb in size? I suspect that isn't needed?

lockyt commented 2 years ago

So waiting for chrome OS recovery image to download before I can see if a video plays

Dis90 commented 2 years ago

You need widevine in order to play drm protected videos. So yes it is needed. realm_config should be in addon_data/plugin.video.discoveryplus but I don't know if LibreELEC is doing something different.

lockyt commented 2 years ago

It was wideline sorry. It was what needed chrome os recovery image.

lockyt commented 2 years ago

And yes added to add-on_data/plugin.video.discoveryplus

Dis90 commented 2 years ago

So everything is working now?

lockyt commented 2 years ago

Had to go off and do something else but I think so. Let you know if any problems. Thanks for your help!

tommyp-vr4 commented 2 years ago

Things seem a little funny here too. The addon isn't working for me today. Where exactly did you put that realm_config? Did you create a file called "realm_config" inside the /storage/.kodi/userdata/addon_data/plugin.video.discoveryplus folder?
Or do you need some arbitrary named file and some arbitrary file extension in a folder named "/storage/.kodi/userdata/addon_data/plugin.video.discoveryplus/realm_config"

Dis90 commented 2 years ago

Are you using latest version (1.6.6)? It should be fixed in it. If yes please post full debug log so I can investigate this issue.

tommyp-vr4 commented 2 years ago

Thank Di90. Yes, I am using 1.6.6. I enabled the full logging, rebooted, ran the addon (and get an error). Then I shopped the logging. I think the mrs said she saw a prob yesterday or the day before too. If it matters, the same computer can play via a webbrowser (chromium). Let me know if you need more info. Thanks! kodi.log

Dis90 commented 2 years ago

Thanks for log. I now know why this is not working. Try copy file __init__.py from /storage/.kodi/addons/plugin.video.discoveryplus/resources to /storage/.kodi/addons/plugin.video.discoveryplus/resources/services

Let me know if that fixes problem.

tommyp-vr4 commented 2 years ago

Bingo! That did the trick. All is back to normal! Works like a champ! Thanks for the fix and for doing what you do!