mmmmmtasty / SportScanner

Scanner and Metadata Agent for Plex that uses sportdb
101 stars 31 forks source link

Cannot connect - SSL errors #25

Closed jbalcorn closed 2 years ago

jbalcorn commented 6 years ago

I'm getting SSL errors trying to use the SportScanner. it appears that thesportsdb.com is behind Cloudflare and it redirects to HTTPS. It requires SNI. I've tried updating my python but I think the problem is simply that we need to call the URL with SNI.

I'm a rank beginner at python, but I'd be happy to help if anyone can point me in the right direction. I'm assuming the HTTP object in the init.py comes from Plex, but I haven't been able to figure out what class it is and how to modify the call to include the server name.

Any ideas?

zag2me commented 6 years ago

I think this was already solved by someone else, take a look here

https://github.com/mmmmmtasty/SportScanner/issues/23

zag2me commented 6 years ago

And yes you are correct, TSDB uses cloudflare SSL redirect for all pages now. This was a recent change. It also support CORS as well.

jbalcorn commented 6 years ago

Yeah, I was able to get the code to work by changing to using a urllib2.urlopen with a SSL context. I'll take a look at that other fork

The HTTP object being sent says it's a HTTPKit object, but that doesn't match what google gives me. Where is the documentation on that HTTP object and where it comes from?

ZyXELis commented 5 years ago

I was not able to get it to authenticate, even with the changes in https://github.com/mmmmmtasty/SportScanner/issues/23 . So I've created an http proxy from http to https on my local server (apache) and changed a code in init.py to:


SPORTSDB_API = "http://localdomain.com/api/v1/json/8123456712556/"

url = url.replace(' ', '%20')
url = url.replace('https://www.thesportsdb.com', 'http://localdomain.com')

            for i in range(len(posters_to_dl)):
                poster_url = posters_to_dl[i].replace('https://www.thesportsdb.com', 'http://localdomain.com')

            for i in range(len(banners_to_dl)):
                banner_url = banners_to_dl[i].replace('https://www.thesportsdb.com', 'http://localdomain.com')

        for i in range(len(fanart_to_dl)):
            fanart_url = fanart_to_dl[i].replace('https://www.thesportsdb.com', 'http://localdomain.com')

----------apache config-----------

ProxyRequests Off

<Proxy *> Order deny,allow Allow from all

SSLProxyEngine on ProxyPass /api https://www.thesportsdb.com/api ProxyPassReverse /api https://www.thesportsdb.com/api

ProxyPass /images https://www.thesportsdb.com/images ProxyPassReverse /images https://www.thesportsdb.com/images

------------done------------

I was not able to work around it other way, my knowledge on programming is very limited so maybe there is a better way. anyhow- now it works. One note- I use apache 2.4 and with lower version the proxy config may differ.