oe-alliance / XMLTV-Import

Import's EPG data from rytec xml data sources.
15 stars 37 forks source link

Https links do not work #37

Closed jenseneverest closed 3 years ago

jenseneverest commented 5 years ago

while http:// links work with the sources.xml if you try to use https:// links they will not. https: is more secure, surely they should work as well.

nickersk commented 5 years ago

hi, if you are using openatv 6.3 version image prior to 22.2.2018, reflash it with newer version and try again if it will work. thx

kiddac commented 4 years ago

This issue really could do with being fixed. Everything is moving over to https://

I hacked my own version of EPGImport.py to work for my own needs. But a better solution is probably needed.

def fetchUrl(self, filename):
    if filename.startswith('http:') or filename.startswith('ftp:'):
        self.do_download(filename, self.afterDownload, self.downloadFail)
    elif filename.startswith('https:'):
        self.do_https_download(filename, self.afterDownload, self.downloadFail)
    else:
        self.afterDownload(None, filename, deleteFile=False)

def do_https_download(self, sourcefile, afterDownload, downloadFail):
    path = bigStorage(9000000, '/tmp', '/media/DOMExtender', '/media/cf', '/media/mmc', '/media/usb', '/media/hdd')
    filename = os.path.join(path, 'epgimport')
    ext = os.path.splitext(sourcefile)[1]
    if ext and len(ext) < 6:
        filename += ext
    sourcefile = sourcefile.encode('utf-8')
    print>>log, "[EPGImport] Downloading: " + sourcefile + " to local path: " + filename
    response = None
    hdr = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
     'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' }
    req = urllib2.Request(sourcefile, headers=hdr)
    success = False
    try:
        response = urllib2.urlopen(req)
        with open(filename,'wb') as output:
            output.write(response.read())
            success = True
            afterDownload(True, filename)
    except urllib2.URLError as e:
        print>>log, (e)
        pass

    except:
        print>>log,"\n ***** unknown error"
        pass

    if not success:
        downloadFail(True)
    return filename
atvcaptain commented 3 years ago

@kiddac have you update the plugin i never use this addon first time with py3 migration :)

davesayers2014 commented 3 years ago

This works for me https://github.com/oe-alliance/XMLTV-Import/pull/50

Thanks to KiddaC for his fix

kiddac commented 3 years ago

I have attached a epgimport.py file that will work on python 2.7 / python 3 and dreamboxes for https urls

EPGImport.zip

atvcaptain commented 3 years ago

merge https://github.com/oe-alliance/XMLTV-Import/commit/a848f6ea018f43a90b6924f5240e4c632992e4cf