コード例 #1
0
    def tryTologin(self):
        printDBG('tryTologin start')

        rm(self.COOKIE_FILE)

        self.login = config.plugins.iptvplayer.filmezzeu_login.value
        self.password = config.plugins.iptvplayer.filmezzeu_password.value

        if '' == self.login.strip() or '' == self.password.strip():
            printDBG('tryTologin wrong login data')
            #self.sessionEx.open(MessageBox, _('The host %s requires registration. \nPlease fill your login and password in the host configuration. Available under blue button.' % self.getMainUrl()), type = MessageBox.TYPE_ERROR, timeout = 10 )
            return False

        url = self.getFullUrl('/bejelentkezes.php')

        post_data = {
            'logname': self.login,
            'logpass': self.password,
            'ref': self.getFullUrl('/index.php')
        }
        httpParams = dict(self.defaultParams)
        httpParams['header'] = dict(httpParams['header'])
        httpParams['header']['Referer'] = url
        sts, data = self.cm.getPage(url, httpParams, post_data)
        if sts and 'kijelentkezes.php' in data:
            printDBG('tryTologin OK')
            return True

        self.sessionEx.open(MessageBox,
                            _('Login failed.'),
                            type=MessageBox.TYPE_ERROR,
                            timeout=10)
        printDBG('tryTologin failed')
        return False
コード例 #2
0
 def doLogin(self, login, password):
     logged = False
     premium = False
     loginUrl = self.getFullUrl('/users/index.php')
     
     rm(self.COOKIE_FILE)
     sts, data = self.cm.getPage(loginUrl, self.http_params)
     if not sts: return False, False
     
     HTTP_HEADER= dict(self.HTTP_HEADER)
     HTTP_HEADER.update( {'Referer':loginUrl} )
     params = dict(self.http_params)
     params['header'] = HTTP_HEADER
     
     post_data = {'user_name': login, 'user_password': password, 'login': '******'}
     sts, data = self.cm.getPage( loginUrl, params, post_data)
     printDBG("-------------------------------------")
     printDBG(data)
     printDBG("-------------------------------------")
     if sts:
         if os_path.isfile(self.COOKIE_FILE):
             if '?logout' in data:
                 printDBG('WizjaTvApi.doLogin login as [%s]' % login)
                 logged = True
                 if 'Premium aktywne do ' in data:
                     premium = True
             else:
                 printDBG('WizjaTvApi.doLogin login failed - wrong user or password?')
         else:
             printDBG('WizjaTvApi.doLogin there is no cookie file after login')
     return logged, premium
コード例 #3
0
    def tryTologin(self, login, password):
        printDBG('tryTologin start')
        connFailed = _('Connection to server failed!')

        loginUrl = self.getFullUrl('users/index/auth')

        rm(self.COOKIE_FILE)
        sts, data = self.cm.getPage(loginUrl, self.defaultParams)
        if not sts: return False, connFailed

        post_data = {"mail": login, "pass": password, "social": "0"}
        params = dict(self.defaultParams)
        HEADER = dict(self.AJAX_HEADER)
        HEADER['Referer'] = self.MAIN_URL
        params.update({'header': HEADER})

        # login
        sts, data = self.cm.getPage(loginUrl, params, post_data)
        if not sts: return False, connFailed

        # check if logged
        sts, data = self.cm.getPage(self.MAIN_URL, self.defaultParams)
        if not sts: return False, connFailed

        if '"ok"' in data:
            return True, 'OK'
        else:
            return False, data
コード例 #4
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)
        if self.MAIN_URL == None:
            rm(self.COOKIE_FILE)
            self.selectDomain()

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode = self.currItem.get("mode", '')

        printDBG(
            "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] "
            % (name, category))
        self.currList = []

        #MAIN MENU
        if name == None:
            self.listMainMenu({'name': 'category'})
        elif category == 'list_threads':
            self.listThreads(self.currItem, 'list_thread')
        elif category == 'list_thread':
            self.listThread(self.currItem)
        elif category == 'list_items':
            self.listItems(self.currItem)
        else:
            printExc()

        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #5
0
    def downloadAndUnpack(self, url, params={}, post_data=None, unpackToSubDir=False):
        data, fileName = self.downloadFileData(url, params, post_data)
        if data == None:
            return None
        ext = fileName.rsplit('.', 1)[-1].lower()
        printDBG("fileName[%s] ext[%s]" % (fileName, ext))
        if ext not in ['zip', 'rar']:
            SetIPTVPlayerLastHostError(_('Unknown file extension "%s".') % ext)
            return None
            
        tmpFile = GetTmpDir( self.TMP_FILE_NAME )
        tmpArchFile = tmpFile + '.' + ext
        tmpDIR = ''
        if unpackToSubDir:
            dirName = fileName.rsplit('.', 1)[0].split('filename=', 1)[-1]
            if dirName != '':
                tmpDIR = GetSubtitlesDir(dirName)
        
        if tmpDIR == '':
            tmpDIR = GetTmpDir(self.TMP_DIR_NAME)
        
        printDBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
        printDBG(fileName)
        printDBG(tmpFile)
        printDBG(tmpArchFile)
        printDBG(tmpDIR)
        printDBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")

        if not self.writeFile(tmpArchFile, data):
            return None
        
        if not self.unpackArchive(tmpArchFile, tmpDIR):
            rm(tmpArchFile)
            return None
        return tmpDIR
コード例 #6
0
    def getLinksForVideo(self, cItem):
        printDBG("IceFilms.getLinksForVideo [%s]" % cItem)
        urlTab = []

        if len(self.cacheLinks.get(cItem['url'], [])):
            return self.cacheLinks[cItem['url']]

        rm(self.COOKIE_FILE)
        sts, data = self.getPage(cItem['url'], self.defaultParams)
        if not sts: return []

        url = self.getFullUrl(
            self.cm.ph.getSearchGroups(
                data, '''<iframe[^>]+?src=['"]([^"^']+?)['"]''', 1, True)[0])
        url = self.getFullUrl(url)

        sts, data = self.getPage(url, self.defaultParams)
        if not sts: return []

        data = self.cm.ph.getDataBeetwenMarkers(data, 'id="srclist"',
                                                'These links brought')[1]
        data = self.cm.ph.getAllItemsBeetwenMarkers(data, 'ripdiv', '</div>')
        for item in data:
            mainTitle = self.cleanHtmlStr(
                self.cm.ph.getDataBeetwenMarkers(item, '<b', '</b>')[1])

            sourcesTab = self.cm.ph.getAllItemsBeetwenMarkers(
                item, '<a', '</i>')
            for source in sourcesTab:
                sourceId = self.cm.ph.getSearchGroups(
                    source, '''onclick=['"]go\((\d+)\)['"]''')[0]
                if sourceId == '': continue
                sourceName = self.cleanHtmlStr(
                    clean_html(source.replace('</a>', ' ')))

                # hostings filter
                # do not add hostings wich require captcha
                add = True
                for notSup in [
                        ' uploadx ', ' uploadz ', ' owndrives ', ' upload ',
                        ' suprafiles'
                ]:
                    if notSup in (' %s ' % sourceName.lower()):
                        add = False
                        break
                if not add: continue
                # end hostings filter

                urlTab.append({
                    'name':
                    '[{0}] {1}'.format(mainTitle, sourceName),
                    'url':
                    strwithmeta(sourceId, {'url': cItem['url']}),
                    'need_resolve':
                    1
                })

        self.cacheLinks[cItem['url']] = urlTab
        return urlTab
コード例 #7
0
    def tryTologin(self):
        printDBG('KinoPodAniolemPL.tryTologin start')

        if None == self.loggedIn or self.login != config.plugins.iptvplayer.kinopodaniolempl_login.value or\
            self.password != config.plugins.iptvplayer.kinopodaniolempl_password.value:

            self.login = config.plugins.iptvplayer.kinopodaniolempl_login.value
            self.password = config.plugins.iptvplayer.kinopodaniolempl_password.value

            rm(self.COOKIE_FILE)

            self.loggedIn = False

            if '' == self.login.strip() or '' == self.password.strip():
                return False

            sts, data = self.getPage(self.getFullUrl('/logowanie'))
            if not sts: return False

            sts, data = self.cm.ph.getDataBeetwenNodes(
                data, ('<form', '>', 'logowanie'), ('</form', '>'))
            if not sts: return False
            actionUrl = self.getFullUrl(
                self.cm.ph.getSearchGroups(data,
                                           '''action=['"]([^'^"]+?)['"]''')[0])
            tmp = self.cm.ph.getAllItemsBeetwenMarkers(data, '<input', '>')
            tmp.extend(
                self.cm.ph.getAllItemsBeetwenMarkers(data, '<button', '>'))
            post_data = {}
            for item in tmp:
                name = self.cm.ph.getSearchGroups(
                    item, '''name=['"]([^'^"]+?)['"]''')[0]
                value = self.cm.ph.getSearchGroups(
                    item, '''value=['"]([^'^"]+?)['"]''')[0]
                post_data[name] = value

            post_data.update({'Login': self.login, 'Password': self.password})

            httpParams = dict(self.defaultParams)
            httpParams['header'] = dict(httpParams['header'])
            httpParams['header']['Referer'] = self.getMainUrl()
            sts, data = self.cm.getPage(actionUrl, httpParams, post_data)
            if sts and '/Logout' in data:
                printDBG('tryTologin OK')
                self.loggedIn = True
                self.konto = self.cleanHtmlStr(
                    self.cm.ph.getDataBeetwenNodes(data, ('<a', '>', '/konto'),
                                                   ('</a', '>'))[1])
            else:
                errorMsg = self.cleanHtmlStr(
                    self.cm.ph.getDataBeetwenNodes(data,
                                                   ('<ul', '>', 'errorList'),
                                                   ('</ul', '>'))[1])
                self.sessionEx.open(MessageBox,
                                    _('Login failed.') + '\n' + errorMsg,
                                    type=MessageBox.TYPE_ERROR,
                                    timeout=10)
                printDBG('tryTologin failed')
        return self.loggedIn
コード例 #8
0
    def tryTologin(self):
        printDBG('tryTologin start')
        self.defUrl = self.getFullUrl('/watch/russiatoday')
        if None == self.loggedIn or self.login != config.plugins.iptvplayer.tvplayercom_login.value or\
            self.password != config.plugins.iptvplayer.tvplayercom_password.value:

            self.login = config.plugins.iptvplayer.tvplayercom_login.value
            self.password = config.plugins.iptvplayer.tvplayercom_password.value

            rm(self.COOKIE_FILE)

            self.loggedIn = False

            if '' == self.login.strip() or '' == self.password.strip():
                return False

            url = self.getFullUrl('/account/login')

            sts, data = self.getPage(url)
            if not sts: return False

            sts, data = self.cm.ph.getDataBeetwenNodes(data,
                                                       ('<form', '>', 'login'),
                                                       ('</form', '>'))
            if not sts: return False
            actionUrl = self.getFullUrl(
                self.cm.ph.getSearchGroups(data,
                                           '''action=['"]([^'^"]+?)['"]''')[0])
            data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<input', '>')
            post_data = {}
            for item in data:
                name = self.cm.ph.getSearchGroups(
                    item, '''name=['"]([^'^"]+?)['"]''')[0]
                value = self.cm.ph.getSearchGroups(
                    item, '''value=['"]([^'^"]+?)['"]''')[0]
                post_data[name] = value

            post_data.update({
                'email': self.login,
                'password': self.password,
                'remember_me': 1
            })

            httpParams = dict(self.defaultParams)
            httpParams['header'] = dict(httpParams['header'])
            httpParams['header'][
                'Content-Type'] = 'application/x-www-form-urlencoded'
            httpParams['header']['Referer'] = url
            sts, data = self.cm.getPage(actionUrl, httpParams, post_data)
            if sts and '/account/logout' in data:
                printDBG('tryTologin OK')
                self.loggedIn = True
            else:
                self.sessionEx.open(MessageBox,
                                    _('Login failed.'),
                                    type=MessageBox.TYPE_ERROR,
                                    timeout=10)
                printDBG('tryTologin failed')
        return self.loggedIn
コード例 #9
0
    def handleService(self, index, refresh = 0, searchPattern = '', searchType = ''):
        printDBG('handleService start')
        
        if self.MAIN_URL == None:
            self.selectDomain()
        
        if (self.login != config.plugins.iptvplayer.mrpiracy_login.value or \
             self.password != config.plugins.iptvplayer.mrpiracy_password.value) and \
            '' != config.plugins.iptvplayer.mrpiracy_login.value.strip() and \
            '' != config.plugins.iptvplayer.mrpiracy_password.value.strip():
           
            self.loggedIn, msg = self.tryTologin()
            if not self.loggedIn:
                userName = config.plugins.iptvplayer.mrpiracy_login.value
                self.sessionEx.open(MessageBox, 'Login failed for user "%s".' % userName, type = MessageBox.TYPE_INFO, timeout = 10 )
            else:
                self.loogin   = config.plugins.iptvplayer.mrpiracy_login.value
                self.password = config.plugins.iptvplayer.mrpiracy_password.value
        elif ('' == config.plugins.iptvplayer.mrpiracy_login.value.strip() or \
              '' == config.plugins.iptvplayer.mrpiracy_password.value.strip()):
           self.sessionEx.open(MessageBox, 'Access to this service requires login.\nPlease register on the site \"%s\". Then log in and then put your login data in the host configuration under blue button.' % self.getMainUrl(), type=MessageBox.TYPE_INFO, timeout=20 )
        
        CBaseHostClass.handleService(self, index, refresh, searchPattern, searchType)

        name     = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode     = self.currItem.get("mode", '')
        
        printDBG( "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] " % (name, category) )
        self.currList = []
        
    #MAIN MENU
        if name == None:
            if (config.plugins.iptvplayer.mrpiracy_login.value == '' or config.plugins.iptvplayer.mrpiracy_password.value == ''):
                rm(self.COOKIE_FILE)
            self.cacheLinks = {}
            self.listsTab(self.MAIN_CAT_TAB, {'name':'category'})
        elif category == 'list_filters':
            self.listFilters(self.currItem, 'list_items')
        elif category == 'list_items':
            self.listItems(self.currItem, 'list_seasons')
        elif category == 'list_seasons':
            self.listSeasons(self.currItem)
        elif category == 'list_episodes':
            self.listEpisodes(self.currItem)
    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item':False, 'name':'category'}) 
            self.listSearchResult(cItem, searchPattern, searchType)
    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({'name':'history', 'category': 'search'}, 'desc', _("Type: "))
        else:
            printExc()
        
        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #10
0
 def getList(self, cItem):
     printDBG("VideoStarApi.getList")
     
     rm(self.COOKIE_FILE)
     
     self.informAboutGeoBlockingIfNeeded('PL')
     
     login    = config.plugins.iptvplayer.videostar_login.value
     password = config.plugins.iptvplayer.videostar_password.value
     if login != '' and password != '':
         self.accountInfo = ''
         ret, msg = self.doLogin(login, password)
         if ret:
             self.loggedIn = True
             self.accountInfo = msg
         else:
             self.sessionEx.open(MessageBox, '%s\nProblem z zalogowanie użytkownika "%s". Sprawdź dane do logowania w konfiguracji hosta.' % (msg, login), type = MessageBox.TYPE_INFO, timeout = 10 )
             self.loggedIn = False
     else:
         self.doLogin('guest', 'guest')
     
     self.cacheChannelList = []
     channelsTab = []
     
     if self.loggedIn:
         url = self.getFullUrl('/channels/list?device=web', 'api')
     else:
         url = self.getFullUrl('/static/guest/channels/list/web.json', 'static')
     
     sts, data = self.cm.getPage(url, self.defaultParams)
     if not sts: return channelsTab
     
     try:
         idx = 0
         data = byteify(json.loads(data), '', True)
         for item in data['channels']:
             guestTimeout = item.get('guest_timeout', '')
             if not config.plugins.iptvplayer.videostar_show_all_channels.value and (item['access_status'] == 'unsubscribed' or (not self.loggedIn and guestTimeout == '0')): continue
             title = self.cleanHtmlStr(item['name'])
             icon  = self.getFullUrl(item.get('thumbnail', '')) 
             url   = self.getFullUrl(item['slug'])
             
             desc = []
             if item.get('hd', False): desc.append('HD')
             else: desc.append('SD')
             if self.loggedIn: desc.append(item['access_status'])
             elif guestTimeout != '': desc.append(_('Guest timeout: %s') % guestTimeout)
             if item.get('geoblocked', False): desc.append('geoblocked')
             
             params = {'name':cItem['name'], 'type':'video', 'title':title, 'url':url, 'icon':icon, 'priv_idx':idx, 'desc':' | '.join(desc)}
             channelsTab.append(params)
             self.cacheChannelList.append(item)
             idx += 1
     except Exception:
         printExc()
     
     return channelsTab
コード例 #11
0
    def getList(self, cItem):
        printDBG("LivetvhdNetApi.getChannelsList")
        channelsTab = []

        try:
            initList = cItem.get('init_list', True)
            if initList:
                rm(self.COOKIE_FILE)
                params = dict(cItem)
                params.update({
                    'init_list': False,
                    'url': 'https://livetvhd.net/api/videos',
                    'title': _('--All--')
                })
                channelsTab.append(params)

                sts, data = self.cm.getPage(
                    'https://livetvhd.net/api/categories')
                if not sts: return []
                data = byteify(json.loads(data))
                for item in data:
                    params = dict(cItem)
                    params.update({
                        'init_list':
                        False,
                        'url':
                        'https://livetvhd.net/api/videos/category/' +
                        item['seo_name'],
                        'title':
                        self.cleanHtmlStr(item['name'])
                    })
                    channelsTab.append(params)
            else:
                sts, data = self.cm.getPage(cItem['url'])
                if not sts: return []
                data = byteify(json.loads(data))
                if 'videos' in data: data = data['videos']
                for item in data:
                    url = item['url']
                    icon = item['thumbnail']
                    title = self.cleanHtmlStr(item['title'])
                    desc = _('Views: ') + str(item.get('views', ''))
                    params = dict(cItem)
                    params.update({
                        'type': 'video',
                        'title': title,
                        'url': url,
                        'desc': desc,
                        'icon': self.getFullIconUrl(icon)
                    })
                    channelsTab.append(params)
        except Exception:
            printExc()
        return channelsTab
コード例 #12
0
    def tryTologin(self):
        printDBG('tryTologin start')

        if None == self.loggedIn or self.login != config.plugins.iptvplayer.serijeonline_login.value or\
            self.password != config.plugins.iptvplayer.serijeonline_password.value:

            self.login = config.plugins.iptvplayer.serijeonline_login.value
            self.password = config.plugins.iptvplayer.serijeonline_password.value

            rm(self.COOKIE_FILE)

            self.loggedIn = False

            if '' == self.login.strip() or '' == self.password.strip():
                return False

            sts, data = self.getPage(self.getFullUrl('/index.html'))
            if not sts: return False

            sts, data = self.cm.ph.getDataBeetwenNodes(
                data, ('<form', '>', 'login_form'), ('</form', '>'))
            if not sts: return False
            actionUrl = self.getFullUrl(
                self.cm.ph.getSearchGroups(data,
                                           '''action=['"]([^'^"]+?)['"]''')[0])
            tmp = self.cm.ph.getAllItemsBeetwenMarkers(data, '<input', '>')
            tmp.extend(
                self.cm.ph.getAllItemsBeetwenMarkers(data, '<button', '>'))
            post_data = {}
            for item in tmp:
                name = self.cm.ph.getSearchGroups(
                    item, '''name=['"]([^'^"]+?)['"]''')[0]
                value = self.cm.ph.getSearchGroups(
                    item, '''value=['"]([^'^"]+?)['"]''')[0]
                post_data[name] = value

            post_data.update({'username': self.login, 'pass': self.password})

            httpParams = dict(self.defaultParams)
            httpParams['header'] = dict(httpParams['header'])
            httpParams['header']['Referer'] = self.getFullUrl('/index.php')
            sts, data = self.cm.getPage(actionUrl, httpParams, post_data)
            if sts and 'do=logout' in data:
                printDBG('tryTologin OK')
                self.loggedIn = True
            else:
                self.sessionEx.open(MessageBox,
                                    _('Login failed.'),
                                    type=MessageBox.TYPE_ERROR,
                                    timeout=10)
                printDBG('tryTologin failed')
        return self.loggedIn
コード例 #13
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)
        if self.MAIN_URL == None:
            rm(self.COOKIE_FILE)
            self.selectDomain()

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode = self.currItem.get("mode", '')

        printDBG(
            "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] "
            % (name, category))
        self.currList = []

        #MAIN MENU
        if name == None:
            self.listMainMenu({'name': 'category'})
        elif category == 'list_categories':
            self.listCategories(self.currItem, 'list_items')
        elif category == 'list_filters':
            self.listFilters(self.currItem, 'list_items')
        elif category == 'list_items':
            self.listItems(self.currItem, 'list_section_items', 'explore_item')
        elif category == 'list_section_items':
            self.listSectionItems(self.currItem, 'explore_item')
        elif category == 'explore_item':
            self.exploreItem(self.currItem, 'list_episodes')
        elif category == 'list_episodes':
            self.listEpisodes(self.currItem)
    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item': False, 'name': 'category'})
            self.listSearchResult(cItem, searchPattern, searchType)

    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({
                'name': 'history',
                'category': 'search'
            }, 'desc', _("Type: "))
        else:
            printExc()

        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #14
0
 def getList(self, cItem):
     printDBG("YooanimeComApi.getChannelsList")
     channelsTab = []
     initList = cItem.get('init_list', True)
     if initList:
         rm(self.COOKIE_FILE)
         self.cacheList = {}
         sts, data = self.cm.getPage(self.MAIN_URL, self.http_params)
         if not sts: return []
         data = self.cm.ph.getDataBeetwenMarkers(data, 'id="menu">',
                                                 '<div class="row">',
                                                 False)[1]
         data = data.split('</i>')
         for item in data:
             tmp = item.split('<ul')
             if len(tmp) != 2: continue
             channels = []
             catTtile = self.cleanHtmlStr(tmp[0])
             tmp = self.cm.ph.getAllItemsBeetwenMarkers(
                 tmp[1], '<li class="channel"', '</li>')
             for channelItem in tmp:
                 url = self.cm.ph.getSearchGroups(
                     channelItem, '''href=['"]([^'^"]+?)['"]''')[0]
                 icon = self.getFullUrl(
                     self.cm.ph.getSearchGroups(
                         channelItem,
                         '''src=['"]([^'^"]+?\.jpe?g[^'^"]*)['"]''')[0])
                 title = self.cleanHtmlStr(channelItem)
                 if '' == icon: icon = cItem.get('icon', '')
                 params = dict(cItem)
                 params.update({
                     'type': 'video',
                     'title': title,
                     'url': url,
                     'icon': icon
                 })
                 channels.append(params)
             if len(channels):
                 self.cacheList[catTtile] = channels
                 params = dict(cItem)
                 params.update({
                     'init_list': False,
                     'url': catTtile,
                     'title': catTtile
                 })
                 channelsTab.append(params)
     else:
         channelsTab = self.cacheList.get(cItem.get('url', 'None'), [])
     return channelsTab
コード例 #15
0
def iptv_js_execute(jscode, params={}):
    sts, tmpPath = CreateTmpFile('.iptv_js.js', jscode)
    if sts:
        cmd = GetDukPath()
        if 'timeout_sec' in params:
            cmd += ' -t %s ' % params['timeout_sec']
        cmd += ' ' + tmpPath + ' 2> /dev/null'
        printDBG("iptv_js_execute cmd[%s]" % cmd)
        ret = iptv_execute()(cmd)

        # leave last script for debug purpose
        if getDebugMode() == '':
            rm(tmpPath)
    else:
        ret = {'sts': False, 'code': -12, 'data': ''}
    printDBG('iptv_js_execute cmd ret[%s]' % ret)
    return ret
コード例 #16
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode = self.currItem.get("mode", '')

        printDBG("handleService: |||| name[%s], category[%s] " %
                 (name, category))
        self.cacheLinks = {}
        self.currList = []

        #MAIN MENU
        if name == None and category == '':
            rm(self.COOKIE_FILE)
            self.listMainMenu({'name': 'category'})
        elif category == 'sub_menu':
            self.listSubMenu(self.currItem, 'sub_items', 'list_items')
        elif category == 'list_items':
            self.listItems(self.currItem, 'explore_item')
        elif category == 'sub_items':
            self.listSubItems(self.currItem)
        elif category == 'top':
            self.listTop(self.currItem, 'sub_items', 'explore_item')
        elif category == 'explore_item':
            self.exploreItem(self.currItem, 'sub_items')
    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item': False, 'name': 'category'})
            self.listSearchResult(cItem, searchPattern, searchType)

    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({
                'name': 'history',
                'category': 'search'
            }, 'desc', _("Type: "))
        else:
            printExc()

        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #17
0
 def getList(self, cItem):
     printDBG("KarwanTvApi.getChannelsList")
     channelsTab = []
     
     try:
         initList = cItem.get('init_list', True)
         if initList:
             rm(self.COOKIE_FILE)
             for item in [{'title':'TV', 'priv_cat':'tv'}, {'url':self.getFullUrl('radio.html'), 'title':'Radio', 'priv_cat':'radio'}]: #{'url':self.getMainUrl24(), 'title':'Karwan24.com', 'priv_cat':'karwan24_tv'}
                 params = dict(cItem)
                 params.update(item)
                 params['init_list'] = False
                 channelsTab.append(params)
         else:
             category = cItem.get('priv_cat', '')
             sts, data = self.cm.getPage(cItem['url'])
             if not sts: return []
             
             if category in ['radio', 'tv']:
                 data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<div class="bt-inner">', '</div>')
                 for item in data:
                     icon  = self.getFullUrl( self.cm.ph.getSearchGroups(item, '''src=['"]([^"^']+?)['"]''')[0] )
                     url   = self.getFullUrl( self.cm.ph.getSearchGroups(item, '''href=['"]([^'^"]+?)['"]''')[0] )
                     title = self.cleanHtmlStr( item )                
                     params = {'name':'karwan.tv', 'title':title, 'url':url, 'icon':icon}
                     if category == 'radio': params['type'] = 'audio'
                     else: params['type'] = 'video'
                     channelsTab.append(params)
             elif category == 'karwan24_tv':
                 m1 = '<div class=column'
                 if m1 not in data: m1 = '<div class="column"'
                 data = self.cm.ph.getAllItemsBeetwenMarkers(data, m1, '</a>')
                 for item in data:
                     icon  = self.getFullUrl24( self.cm.ph.getSearchGroups(item, '''src=['"]([^"^']+?)['"]''')[0] )
                     url   = self.getFullUrl24( self.cm.ph.getSearchGroups(item, '''href=['"]([^'^"]+?)['"]''')[0] )
                     title = self.cleanHtmlStr( self.cm.ph.getSearchGroups(item, '''title=['"]([^'^"]+?)['"]''')[0] )
                     desc = self.cleanHtmlStr( item )                
                     params = {'name':'karwan.tv', 'title':title, 'url':url, 'desc':desc, 'icon':icon}
                     if category == 'radio': params['type'] = 'audio'
                     else: params['type'] = 'video'
                     channelsTab.append(params)
     except Exception:
         printExc()
     return channelsTab
コード例 #18
0
    def tryTologin(self):
        printDBG('tryTologin start')
        self.selectDomain()

        login = config.plugins.iptvplayer.cartoonhd_login.value
        password = config.plugins.iptvplayer.cartoonhd_password.value

        rm(self.COOKIE_FILE)

        if '' == login.strip() or '' == password.strip():
            printDBG('tryTologin wrong login data')
            return False

        sts, data = self.cm.getPage(self.MAIN_URL, self.defaultParams)
        while sts:
            tor = self._getToken(data)
            post_data = {
                'username': login,
                'password': password,
                'action': 'login',
                't': '',
                'token': tor
            }
            params = dict(self.defaultParams)
            params['header'] = dict(params['header'])
            params['header']['Referer'] = self.getMainUrl()
            sts, data = self.cm.getPage(self.getFullUrl('/ajax/login.php'),
                                        params, post_data)
            printDBG(">> [%s]" % data)
            if sts: sts, data = self.cm.getPage(self.getMainUrl(), params)
            if sts and '>Logout<' in data:
                printDBG('tryTologin OK')
                break
            else:
                sts = False
            break

        if not sts:
            self.sessionEx.open(MessageBox,
                                _('Login failed.'),
                                type=MessageBox.TYPE_ERROR,
                                timeout=10)
        printDBG('tryTologin failed')
        return sts
コード例 #19
0
 def doLogin(self, login, password):
     printDBG("UstvnowApi.doLogin")
     rm(self.cookiePath)
     token = ''
     
     sts, data = self.cm.getPage(self.getFullUrl('iphone/1/live/settings'), self.defParams)
     if not sts: return token
     
     printDBG("=================================================================")
     printDBG(data)
     printDBG("=================================================================")
     
     url = self.getFullUrl(self.cm.ph.getSearchGroups(data, '''action=['"]([^'^"]+?)['"]''')[0])
     if not self.cm.isValidUrl(url): return token
     
     post_data = {'username':login, 'password':password, 'device':'iphone'}
     sts, data = self.cm.getPage(url, self.defParams, post_data)
     if sts:
         token = self.cm.getCookieItem(self.cookiePath, 'token')
     return token
コード例 #20
0
 def tryTologin(self):
     printDBG('tryTologin start')
     errMsg = []
     if None == self.loggedIn or self.login != config.plugins.iptvplayer.freediscpl_login.value or\
         self.password != config.plugins.iptvplayer.freediscpl_password.value:
     
         self.login = config.plugins.iptvplayer.freediscpl_login.value
         self.password = config.plugins.iptvplayer.freediscpl_password.value
         
         sts, data = self.getPage(self.getMainUrl())
         if not sts: return None
         
         if 200 != data.meta.get('status_code', 0):
             return None
         
         self.loggedIn = False
         self.loginMessage = ''
         
         if '' == self.login.strip() or '' == self.password.strip():
             if 'btnLogout' in data: rm(self.COOKIE_FILE)
             return False
         
         params = dict(self.defaultParams)
         params['raw_post_data'] = True
         params['header'] = dict(self.AJAX_HEADER)
         params['header']['Referer']= self.getMainUrl()
         
         post_data = {"email_login":self.login,"password_login":self.password,"remember_login":1,"provider_login":""}
         sts, data = self.getPage(self.getFullUrl('/account/signin_set'), params, json.dumps(post_data))
         if not sts: return None
         
         try:
             data = byteify(json.loads(data))
             if data['success'] == True: self.loggedIn = True
             else: errMsg = [self.cleanHtmlStr(data['response']['info'])]
         except Exception:
             printExc()
         
         if self.loggedIn != True:
             self.sessionEx.open(MessageBox, _('Login failed.') + '\n' + '\n'.join(errMsg), type = MessageBox.TYPE_ERROR, timeout = 10)
         return self.loggedIn
コード例 #21
0
    def getLinksForVideo(self, cItem):
        printDBG("WpTV.getLinksForVideo [%s]" % cItem)
        urlTab = []

        rm(self.COOKIE_FILE)
        sts, data = self.cm.getPage(cItem['url'], self.defaultParams)
        if not sts: return []

        vidId = self.cm.ph.getSearchGroups(data, 'data-mid="([^"]+?)"')[0]
        vidUrl = self.MAIN_URL + "player/mid,%s,embed.json" % vidId
        try:
            sts, data = self.cm.getPage(vidUrl, self.defaultParams)
            if not sts: return []

            tmpTab = []
            qMap = {"HQ": '2', "LQ": '1'}
            data = byteify(json.loads(data))
            for item in data['clip']['url']:
                if 'mp4' not in item['type']: continue
                urlTab.append({
                    'name': item['quality'] + ' ' + item['type'],
                    'url': self.getFullUrl(item['url']),
                    'quality': qMap.get(item['quality'], '3'),
                    'need_resolve': 0
                })

            if 0 < len(urlTab):
                max_bitrate = int(
                    config.plugins.iptvplayer.wpDefaultformat.value)

                def __getLinkQuality(itemLink):
                    if 'mobile' in itemLink['name']: return 0
                    return int(itemLink['quality'])

                urlTab = CSelOneLink(urlTab, __getLinkQuality,
                                     max_bitrate).getSortedLinks()
                if config.plugins.iptvplayer.wpUseDF.value:
                    urlTab = [urlTab[0]]
        except Exception:
            printExc()
        return urlTab
コード例 #22
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        printDBG(
            "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] "
            % (name, category))
        self.currList = []

        #MAIN MENU
        if name == None:
            rm(self.COOKIE_FILE)
            self.listsTab(self.MAIN_CAT_TAB, {'name': 'category'})
    #MOVIES
        elif category == 'genres':
            self.listGenres(self.currItem, 'list_movies')
        elif category == 'list_movies':
            self.listMovies(self.currItem)
    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item': False, 'name': 'category'})
            self.listSearchResult(cItem, searchPattern, searchType)

    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({
                'name': 'history',
                'category': 'search'
            }, 'desc', _("Type: "))
        else:
            printExc()

        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #23
0
    def _cmdFinished(self, code, terminated=False):
        printDBG("FFMPEGDownloader._cmdFinished code[%r] terminated[%r]" %
                 (code, terminated))

        if '' == getDebugMode():
            rm(self.fileCmdPath)

        # break circular references
        if None != self.console:
            self.console_appClosed_conn = None
            self.console_stderrAvail_conn = None
            self.console = None

        if terminated:
            self.status = DMHelper.STS.INTERRUPTED
        elif 0 >= self.localFileSize:
            self.status = DMHelper.STS.ERROR
        elif self.totalDuration > 0 and self.totalDuration > self.downloadDuration:
            self.status = DMHelper.STS.INTERRUPTED
        else:
            self.status = DMHelper.STS.DOWNLOADED
        if not terminated:
            self.onFinish()
コード例 #24
0
    def tryTologin(self, login, password):
        printDBG('tryTologin start')
        connFailed = _('Connection to server failed!')

        loginUrl = 'https://www.cda.pl/login'
        rm(self.COOKIE_FILE)
        sts, data = self.cm.getPage(loginUrl, self.defaultParams)
        if not sts: return False, connFailed

        r = self.cm.ph.getSearchGroups(
            data, '''name=['"]r['"][^>]+?value=['"]([^'^"]+?)['"]''', 1,
            True)[0]

        post_data = {
            "r": r,
            "username": login,
            "password": password,
            "login": "******"
        }
        params = dict(self.defaultParams)
        HEADER = dict(self.AJAX_HEADER)
        HEADER['Referer'] = self.MAIN_URL
        params.update({'header': HEADER})

        # login
        sts, data = self.cm.getPage(loginUrl, params, post_data)
        if not sts: return False, connFailed

        # check if logged
        sts, data = self.cm.getPage(self.MAIN_URL, self.defaultParams)
        if not sts: return False, connFailed

        if '/logout' in data:
            return True, 'OK'
        else:
            return False, 'NOT OK'
コード例 #25
0
    def tryTologin(self, login, password):
        printDBG('tryTologin start')
        connFailed = _('Connection to server failed!')

        rm(self.COOKIE_FILE)
        sts, data = self.cm.getPage(self.MAIN_URL, self.defaultParams)
        if not sts: return False, connFailed

        md5Password = md5(password).hexdigest()
        post_data = {
            "vb_login_username": login,
            "vb_login_password_hint": "Hasło",
            "vb_login_password": "",
            "do": "login",
            "s": "",
            "securitytoken": "guest",
            "cookieuser": "******",
            "vb_login_md5password": md5Password,
            "vb_login_md5password_utf8": md5Password
        }
        params = dict(self.defaultParams)
        params.update({'header': self.AJAX_HEADER})  #, 'raw_post_data':True

        # login
        sts, data = self.cm.getPage(self.getFullUrl('login.php?s=&do=login'),
                                    params, post_data)
        if not sts: return False, connFailed

        # check if logged
        sts, data = self.cm.getPage(self.MAIN_URL, self.defaultParams)
        if not sts: return False, connFailed

        if 'do=logout' in data:
            return True, 'OK'
        else:
            return False, 'NOT OK'
コード例 #26
0
    def getLinksForVideo(self, cItem):
        printDBG("StreamComplet.getLinksForVideo [%s]" % cItem)
        urlTab = []

        rm(self.COOKIE_FILE)

        params = dict(self.defaultParams)
        header = dict(self.HEADER)
        header['Referer'] = cItem['url']
        params['header'] = header

        frameUrlsTab = [cItem['url']]

        for idx in range(3):
            newFrameUrlsTab = []
            for frameUrl in frameUrlsTab:
                sts, data = self.cm.getPage(frameUrl, params)
                printDBG(
                    "============================ start ============================"
                )
                printDBG(data)
                printDBG(
                    "============================ end ============================"
                )
                if not sts: continue
                enc1 = self.cm.ph.getDataBeetwenMarkers(
                    data, 'enc1|', '|', False)[1].strip()
                data = self._decodeData(data)
                printDBG(
                    "============================ start ============================"
                )
                printDBG(data)
                printDBG(
                    "============================ end ============================"
                )
                tryLinksTab = re.compile(
                    '<iframe[^>]+?src="([^"]+?)"').findall(data)
                tryLinksTab.extend(
                    re.compile('\s(https?:[^\s]+?)\s').findall(data))
                try:
                    if enc1 != '':
                        tryLinksTab.append(
                            'http://hqq.tv/player/embed_player.php?vid=' +
                            base64.b64decode(enc1))
                except Exception:
                    printExc()

                for item in tryLinksTab:
                    item = item.replace('\\/', '/')
                    if '' == item.strip(): continue
                    if 'facebook' in item: continue
                    if 'wp-content' in item: continue
                    if not self.cm.isValidUrl(item):
                        if item.startswith('../'):
                            item = self.up.getDomain(
                                frameUrl, False) + item.replace('../', '')
                        elif item.startswith('//'):
                            item = 'http://' + item
                        elif item.startswith('/'):
                            item = self.up.getDomain(frameUrl,
                                                     False) + item[1:]
                        else:
                            item = self.up.getDomain(frameUrl,
                                                     False) + item[1:]
                    if 1 == self.up.checkHostSupport(item):
                        urlTab.append({
                            'name': self.up.getHostName(item),
                            'url': item,
                            'need_resolve': 1
                        })
                    else:
                        newFrameUrlsTab.append(item)
            frameUrlsTab = newFrameUrlsTab

        return urlTab
コード例 #27
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)

        self.informAboutGeoBlockingIfNeeded('GB')

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode = self.currItem.get("mode", '')

        printDBG(
            "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] "
            % (name, category))
        self.currList = []

        #MAIN MENU
        if name == None:
            rm(self.COOKIE_FILE)
            self.listMainMenu({
                'name': 'category',
                'url': self.MAIN_URL
            }, 'list_items')
        elif 'live_streams' == category:
            self.listLive(self.currItem)
        elif 'list_channels' == category:
            self.listChannels(self.currItem, 'list_channel')
        elif 'list_channel' == category:
            self.listChannelMenu(self.currItem, 'list_items')
        elif 'list_az_menu' == category:
            self.listAZMenu(self.currItem, 'list_az')
        elif 'list_az' == category:
            self.listAZ(self.currItem, 'list_episodes')
        elif 'list_categories' == category:
            self.listCategories(self.currItem, 'list_cat_filters')
        elif category in 'list_cat_filters':
            self.listCatFilters(self.currItem, 'list_category')
        elif 'list_category' == category:
            self.listCategory(self.currItem)
        elif 'list_items' == category:
            self.listItems(self.currItem, 'list_episodes')
        elif 'list_items2' == category:
            self.listItems2(self.currItem, 'list_episodes')
        elif 'list_items3' == category:
            self.listItems3(self.currItem, 'list_episodes')
        elif 'list_episodes' == category:
            self.listItems(self.currItem, 'video')

    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item': False, 'name': 'category'})
            self.listSearchResult(cItem, searchPattern, searchType)

    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({
                'name': 'history',
                'category': 'search'
            }, 'desc', _("Type: "))
        else:
            printExc()

        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #28
0
 def tryTologin(self):
     printDBG('EuroSportPlayer.tryTologin start')
     errorMsg = _('Error communicating with the server.')
     
     if None == self.loggedIn or self.login != config.plugins.iptvplayer.eurosportplayer_login.value or\
         self.password != config.plugins.iptvplayer.eurosportplayer_password.value:
     
         self.login = config.plugins.iptvplayer.eurosportplayer_login.value
         self.password = config.plugins.iptvplayer.eurosportplayer_password.value
         
         rm(self.COOKIE_FILE)
         
         self.loggedIn = False
         self.loginMessage = ''
         
         if '' == self.login.strip() or '' == self.password.strip():
             msg = ''
             sts, data = self.getPage(self.getMainUrl())
             if sts and '/subscribe' not in data: msg = self.cleanHtmlStr(self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', '"message"'), ('</div', '>'))[1])
             if msg == '': msg = _('The host %s requires subscription.\nPlease fill your login and password in the host configuration - available under blue button.') % self.getMainUrl()
             GetIPTVNotify().push(msg, 'info', 10)
             return False
         
         if not self.getToken('init'):
             msg = _(errorMsg) + _('\nError[1].')
             GetIPTVNotify().push(msg, 'error', 10)
             return False
         
         try:
             baseUrl = self.serverApiData['server_path']['server'] + '/'
             url = self.getFullUrl('/login', baseUrl)
             
             sts, data = self.getPage(url)
             if not sts: return False
             
             getParams = dict(self.defaultParams)
             getParams['raw_post_data'] = True
             getParams['header'] = dict(self.AJAX_HEADER)
         
             clientData = self.serverApiData['prod']['authentication']['client']
             
             url = clientData['links'][0]['href']
             getParams['header'].update(clientData['links'][0]['headers'])
             getParams['header']['Authorization'] = getParams['header']['Authorization'].replace('{encodedUserToken}', self.tokenData['access_token'])
             post_data = '{"type":"email-password","email":{"address":"%s"},"password":{"value":"%s"}}' % (self.login, self.password)
             
             sts, data = self.getPage(url, getParams, post_data)
             if not sts and '401' in str(data):
                 msg =  _('Login failed. Invalid email or password.')
                 GetIPTVNotify().push(msg, 'error', 10)
                 return False
             else:
                 data = byteify(json.loads(data))
                 printDBG(data)
                 self.tokenData['access_code'] = data['code']
                 self.tokenData['access_timeout'] = time.time() + (data['exp'] - data['iat']) / 1000.0
                 
                 if not self.getToken('code'):
                     msg = _(errorMsg) + _('\nError[2].')
                     GetIPTVNotify().push(msg, 'error', 10)
                     return False
                 self.loggedIn = True
         except Exception:
             printExc()
         
         printDBG('EuroSportPlayer.tryTologin end loggedIn[%s]' % self.loggedIn)
         return self.loggedIn
コード例 #29
0
    def handleService(self, index, refresh=0, searchPattern='', searchType=''):
        printDBG('handleService start')

        if self.login != config.plugins.iptvplayer.kreskowkazone_login.value and \
           self.password != config.plugins.iptvplayer.kreskowkazone_password.value and \
           '' != config.plugins.iptvplayer.kreskowkazone_login.value.strip() and \
           '' != config.plugins.iptvplayer.kreskowkazone_password.value.strip():
            loggedIn, msg = self.tryTologin(
                config.plugins.iptvplayer.kreskowkazone_login.value,
                config.plugins.iptvplayer.kreskowkazone_password.value)
            if not loggedIn:
                self.sessionEx.open(
                    MessageBox,
                    'Problem z zalogowaniem użytkownika "%s".' %
                    config.plugins.iptvplayer.kreskowkazone_login.value,
                    type=MessageBox.TYPE_INFO,
                    timeout=10)
            else:
                self.login = config.plugins.iptvplayer.kreskowkazone_login.value
                self.password = config.plugins.iptvplayer.kreskowkazone_password.value
                #self.sessionEx.open(MessageBox, 'Zostałeś poprawnie \nzalogowany.\n' + msg, type = MessageBox.TYPE_INFO, timeout = 10 )

        CBaseHostClass.handleService(self, index, refresh, searchPattern,
                                     searchType)

        name = self.currItem.get("name", '')
        category = self.currItem.get("category", '')
        mode = self.currItem.get("mode", '')

        printDBG(
            "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] "
            % (name, category))
        self.currList = []

        #MAIN MENU
        if name == None:
            if self.login == '' or self.password == '':
                rm(self.COOKIE_FILE)
            self.listsTab(self.MAIN_TAB, {'name': 'category'})
        elif 'main' == category:
            self.listsTab(self.MAIN_CAT_TAB, self.currItem)
        elif 'cartoons' == category:
            self.listsTab(self.CARTOONS_CAT_TAB, self.currItem)
        elif 'rank' == category:
            self.listRankCategories(self.currItem, 'list_rank_items')
        elif 'list_rank_items' == category:
            self.listRankItems(self.currItem, 'list_episodes')
        elif 'list_abc' == category:
            self.listABC(self.currItem, 'list_items')
        elif 'list_items' == category:
            self.listItems(self.currItem, 'list_episodes')
        elif category == 'list_episodes':
            self.listEpisodes(self.currItem)
    #SEARCH
        elif category in ["search", "search_next_page"]:
            cItem = dict(self.currItem)
            cItem.update({'search_item': False, 'name': 'category'})
            self.listSearchResult(cItem, searchPattern, searchType)

    #HISTORIA SEARCH
        elif category == "search_history":
            self.listsHistory({
                'name': 'history',
                'category': 'search'
            }, 'desc', _("Type: "))
        else:
            printExc()
        CBaseHostClass.endHandleService(self, index, refresh)
コード例 #30
0
    def tryTologin(self):
        printDBG('tryTologin start')
        
        if PlusDEDE.login == None and PlusDEDE.password == None:
            if self.readLoginMarker() == self.calcLoginMarker(config.plugins.iptvplayer.plusdede_login.value, config.plugins.iptvplayer.plusdede_password.value):
                PlusDEDE.login = config.plugins.iptvplayer.plusdede_login.value
                PlusDEDE.password = config.plugins.iptvplayer.plusdede_password.value
            else:
                PlusDEDE.password = ''
                PlusDEDE.login = ''
                rm(self.COOKIE_FILE)
        
        if True != self.loggedIn or PlusDEDE.login != config.plugins.iptvplayer.plusdede_login.value or\
            PlusDEDE.password != config.plugins.iptvplayer.plusdede_password.value:
            
            if True != self.loggedIn and PlusDEDE.login == config.plugins.iptvplayer.plusdede_login.value and\
                PlusDEDE.password == config.plugins.iptvplayer.plusdede_password.value:
                sts, data = self.getPage(self.getMainUrl())
                if sts:
                    token = self.cm.ph.getSearchGroups(data, '''(<meta[^>]+?_token[^>]+?/>)''')[0]
                    token = self.cm.ph.getSearchGroups(token, '''content=['"]([^"^']+?)['"]''')[0]
                    if '' != token and '/logout' in data:
                        self.HTTP_HEADER['X-CSRF-TOKEN'] = token
                        self.AJAX_HEADER['X-CSRF-TOKEN'] = token
                        self.loggedIn = True
                        return True
        
            PlusDEDE.login = config.plugins.iptvplayer.plusdede_login.value
            PlusDEDE.password = config.plugins.iptvplayer.plusdede_password.value
            self.saveLoginMarker()
            
            rm(self.COOKIE_FILE)
            
            self.loggedIn = False
            
            if '' == PlusDEDE.login.strip() or '' == PlusDEDE.password.strip():
                self.sessionEx.open(MessageBox, _('The host %s requires registration. \nPlease fill your login and password in the host configuration. Available under blue button.' % self.getMainUrl()), type = MessageBox.TYPE_ERROR, timeout = 10 )
                return False
            
            url = self.getFullUrl('/login?popup=1')
            sts, data = self.getPage(url)
            if not sts: return False
            
            sts, tmp = self.cm.ph.getDataBeetwenNodes(data, ('<form', '>'), ('</form', '>'))
            if not sts: return False
            
            actionUrl = self.getFullUrl(self.cm.ph.getSearchGroups(tmp, '''action=['"]([^'^"]+?)['"]''')[0])
            tmp = self.cm.ph.getAllItemsBeetwenMarkers(tmp, '<input', '>')
            post_data = {}
            for item in tmp:
                name  = self.cm.ph.getSearchGroups(item, '''name=['"]([^'^"]+?)['"]''')[0]
                value = self.cm.ph.getSearchGroups(item, '''value=['"]([^'^"]+?)['"]''')[0]
                post_data[name] = value
            
            post_data.update({'email':PlusDEDE.login, 'password':PlusDEDE.password})
            
            # fill captcha
            #############################################################################################
            imgUrl = self.getFullUrl(self.cm.ph.getSearchGroups(data, '''<img[^>]+?src=['"]([^"^']+?)['"]''')[0])
            if self.cm.isValidUrl(imgUrl):
                header = dict(self.HTTP_HEADER)
                header['Accept'] = 'image/png,image/*;q=0.8,*/*;q=0.5'
                params = dict(self.defaultParams)
                params.update( {'maintype': 'image', 'subtypes':['jpeg', 'png'], 'check_first_bytes':['\xFF\xD8','\xFF\xD9','\x89\x50\x4E\x47'], 'header':header} )
                filePath = GetTmpDir('.iptvplayer_captcha.jpg')
                ret = self.cm.saveWebFile(filePath, imgUrl.replace('&amp;', '&'), params)
                if not ret.get('sts'):
                    SetIPTVPlayerLastHostError(_('Fail to get "%s".') % imgUrl)
                    return False

                params = deepcopy(IPTVMultipleInputBox.DEF_PARAMS)
                params['accep_label'] = self.cleanHtmlStr(self.cm.ph.getDataBeetwenNodes(data, ('<button', '>', 'submit'), ('</button', '>'))[1])

                params['title'] = _('Captcha')
                params['status_text'] = self.cleanHtmlStr(self.cm.ph.getDataBeetwenNodes(data, ('<label', '>', 'captcha'), ('</label', '>'))[1])
                params['with_accept_button'] = True
                params['list'] = []
                item = deepcopy(IPTVMultipleInputBox.DEF_INPUT_PARAMS)
                item['label_size'] = (300,80)
                item['input_size'] = (480,25)
                item['icon_path'] = filePath
                item['title'] = _('Answer')
                item['input']['text'] = ''
                params['list'].append(item)
    
                ret = 0
                retArg = self.sessionEx.waitForFinishOpen(IPTVMultipleInputBox, params)
                printDBG(retArg)
                if retArg and len(retArg) and retArg[0]:
                    printDBG(retArg[0])
                    name = self.cm.ph.getDataBeetwenNodes(data, ('<input', '>', 'captcha'), ('</input', '>'))[1]
                    printDBG(name)
                    name = self.cm.ph.getSearchGroups(name, '''name=['"]([^"^']+?)['"]''')[0]
                    printDBG(name)
                    post_data['captcha'] = retArg[0][0]
            #############################################################################################
            
            httpParams = dict(self.defaultParams)
            httpParams['header'] = dict(self.AJAX_HEADER)
            httpParams['header']['Referer'] = url
            httpParams['header']['X-CSRF-TOKEN'] = self.cm.ph.getSearchGroups(data, '''(<meta[^>]+?_token[^>]+?/>)''')[0]
            httpParams['header']['X-CSRF-TOKEN'] = self.cm.ph.getSearchGroups(httpParams['header']['X-CSRF-TOKEN'], '''content=['"]([^"^']+?)['"]''')[0]
            error = ''
            sts, data = self.cm.getPage(actionUrl, httpParams, post_data)
            try:
                tmp = byteify(json.loads(data))['content']
                printDBG(tmp)
                tmp = self.cm.ph.getAllItemsBeetwenNodes(tmp, ('<div', '>', 'alert'), ('</div', '>'))
                tab = []
                for t in tmp:
                    t = self.cleanHtmlStr(t)
                    if t == '': continue
                    tab.append(t)
                error = ', '.join(tab)
            except Exception:
                printExc()
            
            sts, data = self.getPage(self.getMainUrl())
            if sts and '/logout' in data:
                self.HTTP_HEADER['X-CSRF-TOKEN'] = httpParams['header']['X-CSRF-TOKEN'] 
                self.AJAX_HEADER['X-CSRF-TOKEN'] = httpParams['header']['X-CSRF-TOKEN']
                self.loggedIn = True
            else:
                if error == '': error = _('Login failed.')
                SetIPTVPlayerLastHostError(error)
                printDBG('tryTologin failed')
        return self.loggedIn