Exemplo n.º 1
0
 def __init__(self, item={}):
     self.startitem_ = item
     CBaseHostClass.__init__(self, {'cookie': 'TSIPlayer.cookie1'})
     self.USER_AGENT = self.cm.getDefaultHeader()['User-Agent']
     self.HEADER = {
         'User-Agent': self.USER_AGENT,
         'Accept': 'text/html',
         'Accept-Encoding': 'gzip, deflate',
         'Referer': '',
         'Origin': ''
     }
     self.defaultParams = {
         'header': self.HEADER,
         'use_cookie': True,
         'load_cookie': True,
         'save_cookie': True,
         'cookiefile': self.COOKIE_FILE
     }
     self.DEFAULT_ICON_URL = 'https://i.ibb.co/Q8ZRP0X/yaq9y3ab.png'
     self.import_str = ''
     if config.plugins.iptvplayer.tsi_resolver.value == 'tsiplayer':
         self.ts_up = ts_urlparser()
     else:
         self.ts_up = urlparser()
Exemplo n.º 2
0
    def getVideos1(self, videoUrl):
        urlTab = []
        refer = ''
        if '|' in videoUrl:
            url_ref, refer = videoUrl.split('|')
            videoUrl = url_ref
        printDBG("1")
        if videoUrl.startswith('http'):
            i = 0
            while True:
                i = i + 1
                printDBG(str(i) + ">>>>Start<<<< " + videoUrl)
                oldURL = videoUrl
                videoUrl = self.extractLink(videoUrl, refer)
                printDBG(str(i) + ">>>>End<<<< " + videoUrl)
                if videoUrl.startswith('['):
                    _data3 = re.findall('label":"(.*?)".*?file":"(.*?)"',
                                        videoUrl, re.S)
                    for (label, uurl) in _data3:
                        urlTab.append((label + '|' + uurl, '4'))
                    break
                elif videoUrl == 'None':
                    printDBG('1')
                    urlTab.append((oldURL, '1'))
                    break
                elif '.m3u8' in videoUrl:
                    printDBG('2')
                    URL1 = strwithmeta(videoUrl, {'Referer': url_ref})
                    urlTab.append((URL1, '3'))
                    break
                elif 'arabramadan' in videoUrl:
                    params = dict(self.defaultParams)
                    params['header']['Referer'] = oldURL
                    sts, data = self.getPage(videoUrl, params)
                    if sts:
                        _data3 = re.findall('JuicyCodes.Run\("(.*?)"\)', data,
                                            re.S)
                        if _data3:
                            packed = base64.b64decode(_data3[0].replace(
                                '"+"', ''))
                            printDBG('packed' + packed)
                            Unpacked = cPacker().unpack(packed)
                            printDBG('packed' + Unpacked)
                            meta_ = {
                                'Referer':
                                'https://arabramadan.com/embed/L00w0FyU0if4mHD/'
                            }
                            _data3 = re.findall(
                                'src".*?"(.*?)".*?label":"(.*?)"', Unpacked,
                                re.S)
                            for (uurl, ttitre) in _data3:
                                uurl = strwithmeta(ttitre + '|' + uurl, meta_)
                                urlTab.append((uurl, '4'))
                    break
                elif 'gdriveplayer' in videoUrl:
                    params = dict(self.defaultParams)
                    params['header']['Referer'] = oldURL
                    sts, data = self.getPage(videoUrl, params)
                    if sts:
                        result = re.findall('(eval\(function\(p.*?)</script>',
                                            data, re.S)
                        if result:
                            data = result[0].strip()
                            printDBG('eval trouver=' + result[0].strip() + '#')
                            data0 = cPacker().unpack(result[0].strip())
                            printDBG('data0=' + data0 + '#')
                            result = re.findall(
                                'data=.*?(\{.*?}).*?null.*?[\'"](.*?)[\'"]',
                                data0, re.S)
                            if result:
                                code_ = json_loads(result[0][0])
                                printDBG('Code=' + str(code_))
                                data1 = result[0][1].strip().replace('\\', '')
                                printDBG('data1=' + data1)
                                lst = re.compile("[A-Za-z]{1,}").split(data1)
                                printDBG('lst=' + str(lst))
                                script = ''
                                for elm in lst:
                                    script = script + chr(int(elm))
                                printDBG('script=' + script)
                                result = re.findall('pass.*?[\'"](.*?)[\'"]',
                                                    script, re.S)
                                if result:
                                    pass_ = result[0]
                                    printDBG('pass_=' + pass_)
                                    ciphertext = base64.b64decode(code_['ct'])
                                    iv = unhexlify(code_['iv'])
                                    salt = unhexlify(code_['s'])
                                    b = pass_
                                    decrypted = cryptoJS_AES_decrypt(
                                        ciphertext, b, salt)
                                    printDBG('decrypted=' + decrypted)
                                    data2 = decrypted[1:-1]
                                    #data2 = decrypted.replace('"','').strip()
                                    printDBG('data2=' + data2)
                                    data2 = cPacker().unpack(data2)
                                    printDBG('data2=' + data2)
                                    url_list = re.findall(
                                        'sources:(\[.*?\])', data2, re.S)
                                    #for data3 in url_list:
                                    data3 = url_list[0]
                                    data3 = data3.replace('\\', '').replace(
                                        '"+countcheck+"', '')
                                    printDBG('data3=' + data3 + '#')
                                    src_lst = json_loads(data3)
                                    printDBG('src_lst=' + str(src_lst) + '#')
                                    for elm in src_lst:
                                        _url = elm['file']
                                        _label = elm.get('label', 'Google')
                                        if 'm3u8' in _url:
                                            urlTab.append((_url, '3'))
                                        else:
                                            urlTab.append(
                                                ('Google (' + _label + ')|' +
                                                 _url, '4'))
                    break

                elif 'aflamyz' in videoUrl:
                    params = dict(self.defaultParams)
                    params['header']['Referer'] = oldURL
                    sts, data = self.getPage(videoUrl, params)
                    if sts:
                        result = re.findall('data-en="(.*?)".*?data-p="(.*?)"',
                                            data, re.S)
                        if result:
                            code_ = json_loads(urllib.unquote(result[0][0]))
                            pass_ = result[0][1]
                            printDBG('Code=' + str(code_))
                            printDBG('Pass='******'ct'])
                            iv = unhexlify(code_['iv'])
                            salt = unhexlify(code_['s'])
                            b = pass_
                            decrypted = cryptoJS_AES_decrypt(
                                ciphertext, b, salt)
                            printDBG('decrypted=' + decrypted)
                            URL = decrypted.replace('\/', '/').replace('"', '')
                            printDBG('URL=' + URL)
                            params['header']['Referer'] = videoUrl
                            sts, data = self.getPage(URL, params)
                            if sts:
                                url_list = re.findall('"sources":(\[.*?\])',
                                                      data, re.S)
                                if url_list:
                                    src_lst = json_loads(url_list[0])
                                    printDBG('src_lst=' + str(src_lst) + '#')
                                    for elm in src_lst:
                                        _url = elm['file']
                                        _label = elm.get('label', 'Aflamyz')
                                        if 'm3u8' in _url:
                                            urlTab.append((_url, '3'))
                                        else:
                                            urlTab.append(
                                                ('Aflamyz (' + _label + ')|' +
                                                 _url, '4'))
                    break

                elif (self.up.checkHostSupport(videoUrl)
                      == 1) or (ts_urlparser().checkHostSupport(videoUrl)
                                == 1):
                    printDBG('3')
                    urlTab.append((videoUrl, '1'))
                    break
                printDBG('4')

        else:
            printDBG("2")
            post_data = {
                'action': 'doo_player_ajax',
                'post': videoUrl,
                'nume': 'trailer',
                'type': 'movie'
            }
            sts, data2 = self.getPage(self.MAIN_URL +
                                      '/wp-admin/admin-ajax.php',
                                      post_data=post_data)
            if sts:
                printDBG("20")
                _data0 = re.findall('<iframe.*?src="(.*?)"', data2, re.S)
                if _data0:
                    urlTab.append((_data0[0], '1'))
        return urlTab
Exemplo n.º 3
0
 def get_links(self, cItem):
     urlTab = []
     gnr = cItem.get('gnr', 0)
     sHosterIdentifier = cItem['sHosterIdentifier']
     sMediaUrl = cItem['url']
     printDBG('get_links URL=' + str(sMediaUrl))
     printDBG('sys.argv=' + str(sys.argv))
     if (sHosterIdentifier == 'lien_direct') or (sHosterIdentifier == ''):
         gnr = 0
     if gnr == 0:
         URL, meta_ = get_url_meta(sMediaUrl)
         if 'm3u8' in URL:
             URL = strwithmeta(URL, meta_)
             urlTab = getDirectM3U8Playlist(URL,
                                            False,
                                            checkContent=True,
                                            sortWithMaxBitrate=999999999)
         else:
             URL = strwithmeta(URL, meta_)
             urlTab.append({
                 'name': 'Direct',
                 'url': URL,
                 'need_resolve': 0
             })
     elif gnr == 1:
         try_tsiplayer = False
         try:
             from Plugins.Extensions.IPTVPlayer.tsiplayer.addons.resources.lib.gui.hoster import cHosterGui
             cHoster = cHosterGui()
             oHoster = cHoster.getHoster(sHosterIdentifier)
             oHoster.setUrl(sMediaUrl)
             aLink = oHoster.getMediaLink()
             printDBG('aLink=' + str(aLink))
         except Exception, e:
             aLink = [False, '']
             printExc()
         if aLink:
             if (aLink[0] == True):
                 URL = aLink[1]
                 if '||' in URL: urls = URL.split('||')
                 else: urls = [URL]
                 for URL in urls:
                     if URL.strip() <> '':
                         label = ''
                         if '|tag:' in URL:
                             URL, label = URL.split('|tag:', 1)
                         URL, meta = get_url_meta(URL)
                         URL = strwithmeta(URL, meta)
                         printDBG('URL=' + URL)
                         urlTab.append({
                             'url':
                             URL,
                             'name':
                             sHosterIdentifier + ' ' + label
                         })
             else:
                 try_tsiplayer = True
         else:
             try_tsiplayer = True
         if try_tsiplayer:
             printDBG('Try with TSIPLAYER Parser')
             if (ts_urlparser().checkHostSupport(
                     str(sMediaUrl)) == 1) or (urlparser().checkHostSupport(
                         str(sMediaUrl)) == 1):
                 url_ = str(sMediaUrl).replace(
                     '://www.youtube.com/embed/',
                     '://www.youtube.com/watch?v=')
                 printDBG('TSIPLAYER Parser Found :' + url_ + '(' +
                          str(sMediaUrl) + ')')
                 urlTab.append({
                     'name': 'Tsiplayer',
                     'url': url_,
                     'need_resolve': 1
                 })
Exemplo n.º 4
0
    def pro_listing(self, cItem):
        image = cItem['icon']
        EPG_ = cItem.get('EPG', False)
        import_ = cItem.get('import_', '')
        nb_list = len(self.datas)
        if EPG_:
            desc_tmdb = get_desc(self.getArticle(cItem))
        else:
            desc_tmdb = ''
        for elm in self.datas:
            sTitle = elm['sTitle']
            sDescription = elm['sDescription']
            sSiteName = elm['sSiteName']
            sHosterIdentifier = elm['sHosterIdentifier']
            sFunction = elm['sFunction']
            sSiteUrl = elm['sSiteUrl']
            sMediaUrl = elm['sMediaUrl']
            sMeta = elm['sMeta']
            argv = elm['argv']
            #sIcon              = elm['sIcon']
            sThumbnail = elm['sThumbnail']
            sFileName = elm['sFileName']
            Year = elm['Year']

            sMeta = str(sMeta).replace('1', 'movie').replace(
                '2', 'tvshow').replace('3', 'collection').replace(
                    '4', 'anime').replace('7',
                                          'person').replace('8', 'network')
            if sMeta in [
                    'tvshow', 'movie', 'collection', 'anime', 'person',
                    'network'
            ]:
                EPG = True
            else:
                EPG = False
            if sFunction.lower() in self.fncs_search:
                EPG = False
            sThumbnail = sThumbnail.replace(
                'special://home/addons/plugin.video.vstream/resources/',
                'file:///usr/lib/enigma2/python/Plugins/Extensions/IPTVPlayer/tsiplayer/addons/resources/'
            )
            image = sThumbnail
            sTitle = replaceColors(str(sTitle))

            if desc_tmdb != '':
                sDescription = desc_tmdb
            else:
                sDescription = replaceColors(str(sDescription)).strip()
                sDescription = sDescription.replace('[I]',
                                                    '').replace('[/I]', '')
                if str(Year).strip() != '':
                    if sDescription == '':
                        sDescription = tscolor(
                            '\c00????00') + 'Year: ' + tscolor(
                                '\c00??????') + str(Year)
                    else:
                        sDescription = sDescription + '\n' + tscolor(
                            '\c00????00') + 'Year: ' + tscolor(
                                '\c00??????') + str(Year)

            if ('Outils' != sTitle.strip()) and (
                    'Mes comptes' != sTitle.strip()) and ('Marque-pages' !=
                                                          sTitle.strip()):
                if sFunction == 'DoNothing':
                    if (nb_list == 1) and (sTitle.strip() == ''):
                        sTitle = tscolor('\c00??8888') + 'No informations'
                    self.addMarker({
                        'title': sTitle,
                        'desc': '',
                        'icon': image
                    })
                elif (sFunction == 'play') or ((sSiteName == 'radio') and
                                               (sFunction == '')):
                    if (sMediaUrl != ''):
                        url = sMediaUrl
                    else:
                        url = sSiteUrl

                    if (sHosterIdentifier == 'lien_direct'):
                        host = 'direct'
                    else:
                        host = 'none'
                    host = 'tshost'
                    #if (sSiteName=='radio'):
                    #    url = sMediaUrl
                    #host = 'direct'
                    color = ''
                    host_ = urlparser.getDomain(url).replace('www.', '')
                    if sHosterIdentifier == 'lien_direct':
                        color = tscolor('\c0060??60')
                    elif ts_urlparser().checkHostSupportbyname(host_):
                        color = tscolor('\c0090??20')
                    elif ts_urlparser().checkHostNotSupportbyname(host_):
                        color = tscolor('\c00??3030')
                    elif ts_urlparser().checkHostSupportbyname_e2iplayer(
                            host_):
                        color = tscolor('\c00????60')

                    sTitle = '| ' + sTitle + ' | ' + color + urlparser.getDomain(
                        url).replace('www.', '').title()
                    sDescription = tscolor('\c00????00') + 'Host: ' + tscolor(
                        '\c00??????') + sHosterIdentifier.title(
                        ) + '\n' + sDescription
                    self.addVideo({
                        'import': cItem['import'],
                        'good_for_fav': True,
                        'category': 'video',
                        'url': url,
                        'sHosterIdentifier': sHosterIdentifier,
                        'title': sTitle,
                        'desc': sDescription,
                        'icon': image,
                        'hst': host,
                        'gnr': 1
                    })
                    printDBG(
                        str({
                            'import': cItem['import'],
                            'good_for_fav': True,
                            'category': 'video',
                            'url': url,
                            'sHosterIdentifier': sHosterIdentifier,
                            'title': sTitle,
                            'desc': sDescription,
                            'icon': image,
                            'hst': host,
                            'gnr': 1
                        }))

                elif sTitle != 'None':
                    dir = {
                        'good_for_fav': True,
                        'EPG': EPG,
                        'sMeta': sMeta,
                        'import': cItem['import'],
                        'sFileName': sFileName,
                        'Year': Year,
                        'category': 'host2',
                        'title': sTitle,
                        'sFunction': sFunction,
                        'sSiteUrl': sSiteUrl,
                        'desc': sDescription,
                        'sSiteName': sSiteName,
                        'argv': argv,
                        'icon': image,
                        'mode': '10',
                        'import_': import_,
                        'hst': 'tshost'
                    }
                    printDBG(dir)
                    self.addDir(dir)
Exemplo n.º 5
0
    def getLinksForVideo(self, cItem):
        printDBG("TVProart.getLinksForVideo [%s]" % cItem)
        name = cItem['title']
        hst = cItem['hst']

        urlTab = []
        if hst == 'direct':
            urlTab.append({
                'name': name,
                'url': cItem['url'],
                'need_resolve': 0
            })
        elif hst == 'none':
            urlTab.append({
                'name': name,
                'url': cItem['url'],
                'need_resolve': 1
            })
        elif hst == 'tshost':
            import_str = cItem.get('import', self.import_str)
            if self.import_str != import_str:
                exec(import_str + 'TSIPHost')
                self.import_str = import_str
                self.host_ = TSIPHost()
            urlTab0 = self.host_.get_links(cItem)
            urlTab = []
            for elm in urlTab0:
                name_ = elm.get('name', 'XXXX')
                type_ = elm.get('type', 'XXXX')
                color = ''
                name_ = name_.replace('\c0060??60', '').replace(
                    '\c0090??20', '').replace('\c00??3030', '').replace(
                        '\C0060??60',
                        '').replace('\C0090??20',
                                    '').replace('\C00??3030', '')
                if config.plugins.iptvplayer.tsi_resolver.value == 'tsiplayer':
                    printDBG('name_===' + name_)
                    if type_ == 'local':
                        color = tscolor('\c0060??60')
                    elif ts_urlparser().checkHostSupportbyname(name_):
                        color = tscolor('\c0090??20')
                    elif ts_urlparser().checkHostNotSupportbyname(name_):
                        color = tscolor('\c00??3030')
                    elif ts_urlparser().checkHostSupportbyname_e2iplayer(
                            name_):
                        color = tscolor('\c00????60')
                else:
                    if type_ == 'local':
                        color = tscolor('\c0060??60')
                    else:
                        color = tscolor('\c00????60')

                if '|' in name_:
                    name_ = name_.replace(
                        name_.split('|')[-1],
                        color + name_.split('|')[-1].lower().replace(
                            'www.', '').title())
                else:
                    name_ = color + name_.lower().replace('www.', '').title()
                elm['name'] = name_
                urlTab.append(elm)

        else:
            exec('urlTab = self.' + hst + '_links(cItem[\'url\'])')
        return urlTab