当前位置: 首页>>代码示例>>Python>>正文


Python CParsingHelper.getSearchGroups方法代码示例

本文整理汇总了Python中Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper.getSearchGroups方法的典型用法代码示例。如果您正苦于以下问题:Python CParsingHelper.getSearchGroups方法的具体用法?Python CParsingHelper.getSearchGroups怎么用?Python CParsingHelper.getSearchGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper的用法示例。


在下文中一共展示了CParsingHelper.getSearchGroups方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getLink

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def getLink(self, url):
     printDBG("getLink url[%s]" % url)
     urlItem = url.split('|')
     if 3 == len(urlItem):
         url        = urlItem[0]
         post_data  = { 'action': 'getPlayer', 'id': urlItem[1], 'playerType': urlItem[2] }
         HEADER = dict(self.AJAX_HEADER)
         HEADER['Referer'] = url
         if 'free' == urlItem[2]:
             http_params = {'header': HEADER}
         else:
             http_params = {'header': HEADER, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE}
             
         sts, data = self.cm.getPage( url, http_params, post_data)
         if not sts: return ''
         data = CParsingHelper.getDataBeetwenMarkers(data, '<div class="player">', '<div class="playerTypes">', False)[1]
         if 'free' == urlItem[2]:
             data = CParsingHelper.getSearchGroups(data, '<iframe [^>]*?src="([^"]+?)"')[0]
             sts, data = self.cm.getPage( data )
             if not sts: return ''
             data = CParsingHelper.getSearchGroups(data, '<iframe [^>]*?src="([^"]+?)"')[0]
             return self.up.getVideoLink( data )
         else:
             return CParsingHelper.getSearchGroups(data, 'url: [\'"](http[^\'"]+?)[\'"]')[0]
         return ''
     else:
         return url
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:29,代码来源:hostplaytube.py

示例2: listItems

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
    def listItems(self, data, itemType, nextPageItem=None, getPlot=None, setRating=True, ver=''):
        for item in data:
            icon  = CParsingHelper.getSearchGroups(item, 'src="([^"]+?jpg)"')[0]
            url   = CParsingHelper.getSearchGroups(item, 'href="([^"]+?)"')[0]
            title = CParsingHelper.getSearchGroups(item, 'title="([^"]+?)"')[0]
            if '' == title: title = CParsingHelper.getSearchGroups(item, '<div class="title">([^<]+?)</div>')[0]
            
            strRating = ''
            if setRating:
                strRating = CParsingHelper.getSearchGroups(item, '<div class="rating" style="width:([0-9]+?)\%">')[0]
                if '' == strRating: strRating = '0'
                strRating = 'Ocena: %s | ' % (str(int(strRating)/10) + '/10')
            
            if None == getPlot: plot = CParsingHelper.getDataBeetwenMarkers(item, '<div class="description">', '<a', False)[1]
            else:               plot = getPlot(item)
            plot  = self.cleanHtmlStr(plot)
            # validate data
            if '' == url or '' == title: continue
            if not url.startswith('http'): url = self.MAINURL + url
            if len(icon) and not icon.startswith('http'): icon = self.MAINURL + icon
            
            if 'video' == itemType:
                params = {'title':title, 'url':url, 'icon':icon, 'plot': strRating + plot, 'ver': ver}
                self.addVideo(params)
            else:
                params = {'name': 'category', 'title':title, 'category': itemType, 'url':url, 'icon':icon, 'plot': strRating + plot}
                self.addDir(params)

        if None != nextPageItem:
            self.addDir(nextPageItem)
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:32,代码来源:hostplaytube.py

示例3: getVideoUrl

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
    def getVideoUrl(self, url):
        #show adult content
        #self.cm.addCookieItem(COOKIEFILE, {'name': 'AnyF18', 'value': 'mam18', 'domain': 'video.anyfiles.pl'}, False)
        if not self.isLogged():
            self.tryTologin()

        # GET VIDEO ID
        u = url.split('/')
        vidID = u[-1]
        match = re.search('([0-9]+?)\,', url )
        if match:
            vidID = match.group(1)

        # get COOKIE
        sts, data = self.cm.getPage(self.MAINURL + '/videos.jsp?id=' + vidID, self.defaultParams)
        if not sts: 
            return []
        fUrl = self.MAINURL + "/w.jsp?id=%s&width=620&height=349&pos=&skin=0" % vidID
        COOKIE_JSESSIONID = self.cm.getCookieItem(self.COOKIEFILE,'JSESSIONID')
        HEADER = {'Referer' : url, 'Cookie' : 'JSESSIONID=' + COOKIE_JSESSIONID, 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0'}
        request_param = {'header':HEADER}
        sts, data = self.cm.getPage(fUrl, request_param)
        if not sts: 
            return []
        
        #document.cookie = "__utdc_8a85608c7ff88b4de47cdc08107a8108=f68082abdaab664660b0c60289346552"+expires+"; path=";
        match = re.search('document.cookie = "([^"]+?)"',data)
        if match:
            printDBG("========================================================================== B")
            #printDBG(data)
            printDBG("========================================================================== C")
            HEADER['Cookie'] = HEADER['Cookie'] + '; ' + match.group(1)
            HEADER['Referer'] = self.MAINURL + '/flowplaer/flowplayer.commercial-3.2.16.swf'
            config = CParsingHelper.getSearchGroups(data, 'var flashvars = {[^"]+?config: "([^"]+?)" }', 1)[0]
            if '' == config: 
                printDBG("========================================================================== D")
                config = CParsingHelper.getSearchGroups(data, 'src="/?(pcsevlet\?code=[^"]+?)"', 1)[0]
            if '' != config:
                printDBG("========================================================================== E")
                sts,data = self.cm.getPage( self.MAINURL + '/' + config,  {'header': HEADER})
                if sts:
                    url = CParsingHelper.getSearchGroups(data, "'url':'(http[^']+?mp4)'", 1)[0]
                    if '' != url: 
                        return [{ 'name': 'AnyFiles', 'url': url}]
                    url = CParsingHelper.getSearchGroups(data, "'url':'api:([^']+?)'", 1)[0]
                    if '' != url: 
                        return self.getYTVideoUrl('http://www.youtube.com/watch?v='+url)
        return []
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:50,代码来源:anyfilesapi.py

示例4: __init__

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
    def __init__(self, session, params={}):
        # params: vk_title, movie_title
        self.session = session
        Screen.__init__(self, session)
        
        self.params = params
        self.params['login']    = config.plugins.iptvplayer.opensuborg_login.value
        self.params['password'] = config.plugins.iptvplayer.opensuborg_password.value
        
        self.searchPattern = CParsingHelper.getNormalizeStr( self.params.get('movie_title', '') )
        
        # try to guess season and episode number
        try:
            tmp = CParsingHelper.getSearchGroups(self.searchPattern + ' ', 's([0-9]+?)e([0-9]+?)[^0-9]', 2)
            self.episodeData = {'season': int(tmp[0]), 'episode':int(tmp[1])}
        except:
            self.episodeData = {'season':-1, 'episode':-1}

        self.onShown.append(self.onStart)
        self.onClose.append(self.__onClose)
        
        self.subProvider = OpenSubOrgProvider()
        
        self["title"]         = Label(" ")
        self["console"]       = Label(" ")
        
        self["label_red"]     = Label(_("Cancel"))
        self["label_yellow"]  = Label(_("Move group"))
        self["label_green"]   = Label(_("Apply"))
        
        self["icon_red"]     = Cover3()
        self["icon_yellow"]  = Cover3()
        self["icon_green"]   = Cover3()
        
        self["list"] = IPTVMainNavigatorList()
        self["list"].connectSelChanged(self.onSelectionChanged)
        
        self["actions"] = ActionMap(["ColorActions", "SetupActions", "WizardActions", "ListboxActions"],
            {
                "cancel": self.keyExit,
                "ok"    : self.keyOK,
                "red"   : self.keyRed,
                "yellow": self.keyYellow,
                "green" : self.keyGreen,
            }, -2)
        
        self.iconPixmap = {}
        for icon in ['red', 'yellow', 'green']:
            self.iconPixmap[icon] = LoadPixmap(GetIconDir(icon+'.png'))
            
        self.movieTitle = ''
        self.stackList  = []
        self.stackItems = []
        
        self.defaultLanguage = GetDefaultLang()
    
        self.listMode = False
        self.downloadedSubFilePath = ''
        self.loginPassed = False
        self.tmpItem = None
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:62,代码来源:iptvsubdownloader.py

示例5: __addLastVersion

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def __addLastVersion(self, servers):
     mainUrl = "https://gitlab.com/iptvplayer-for-e2/iptvplayer-for-e2"
     sts, data = self.cm.getPage(mainUrl + '/tree/master')
     if sts:
         crcSum = CParsingHelper.getSearchGroups(data, '"/iptvplayer-for-e2/iptvplayer-for-e2/commit/([^"]+?)">')[0]
         if 40 == len(crcSum):
             finalurl = mainUrl + '/blob/%s/IPTVPlayer/version.py' % crcSum
             sts, data = self.cm.getPage(finalurl)
             if sts:
                 newVerNum = CParsingHelper.getSearchGroups(data, '&quot;([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)&quot;')[0]
                 sourceUrl = mainUrl + "/repository/archive.tar.gz?ref=%s" % crcSum
                 server = {'name':'gitlab.com', 'version':newVerNum, 'url':sourceUrl, 'subdir':'iptvplayer-for-e2.git/', 'pyver':'X.X', 'packagetype':'sourcecode'}
                 printDBG("UpdateMainAppImpl.__addLastVersion server: [%s]" % str(server))
                 servers.append(server)
         else:
             printDBG("Wrong crcSum[%s]" % crcSum)
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:18,代码来源:updatemainwindow.py

示例6: listsCategoriesMenu

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def listsCategoriesMenu(self, url):
     sts, data = self.cm.getPage( url, {'header': self.HEADER } )
     if not sts: return 
     data = CParsingHelper.getDataBeetwenMarkers(data, 'movie-kat-selection">', '</ul>', False)[1]
     data = data.split('</li>')
     for item in data:
         title = self.cleanHtmlStr(item)
         catID = CParsingHelper.getSearchGroups(item, 'data-value="([^"]+?)"', 1)[0]
         params = {'name': 'category', 'title': title, 'category': catID}
         self.addDir(params)
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:12,代码来源:hostkinoman.py

示例7: getVideoUrl

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
    def getVideoUrl(self, url):
        #show adult content
        #self.cm.addCookieItem(COOKIEFILE, {'name': 'AnyF18', 'value': 'mam18', 'domain': 'video.anyfiles.pl'}, False)
        if not self.isLogged():
            self.tryTologin()

        # GET VIDEO ID
        u = url.split('/')
        vidID = u[-1]
        match = re.search('([0-9]+?)\,', url )
        if match:
            vidID = match.group(1)

        # get COOKIE
        url = self.MAINURL + '/videos.jsp?id=' + vidID
        sts, data = self.cm.getPage(url, self.defaultParams)
        if not sts: 
            return []
        fUrl = self.MAINURL + "/w.jsp?id=%s&width=620&height=349&pos=0&skin=0" % vidID
        COOKIE_JSESSIONID = self.cm.getCookieItem(self.COOKIEFILE,'JSESSIONID')
        HEADER = {'Referer' : url, 'Cookie' : 'JSESSIONID=' + COOKIE_JSESSIONID + ';', 'User-Agent': "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; androVM for VirtualBox ('Tablet' version with phone caps) Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30"}
        request_param = {'header':HEADER}
        sts, data = self.cm.getPage(fUrl, request_param)
        if not sts: return []
        HEADER['Referer'] = fUrl
        config = CParsingHelper.getSearchGroups(data, 'src="/?(pcs\?code=[^"]+?)"', 1)[0]
        if '' != config:
            sts,data = self.cm.getPage( self.MAINURL + '/' + config,  {'header': HEADER})
            if sts:
                #var source = "<source src=\"http://50.7.220.66/video/60ExQvchsi4PbqMLr--I7A/1433518629/5e638de7a15c7a8dc7c979044cd2a953_147325.mp4\" type=\"video/mp4\" />";
                #var track = "<track label=\"izombie.112...\" srclang=\"pl\" kind=\"captions\"  src=\"http://video.anyfiles.pl/subtit/1433508336949.srt\"></track>\n";
                data = data.replace('\\"', '"')
                #printDBG(data)
                difSourcesSrc = CParsingHelper.getSearchGroups(data, '''difSourcesSrc[^=]*?=[^"']*?["'](http[^'^"]+?)['"]''', 1)[0] 
                url    = CParsingHelper.getSearchGroups(data, '''<source[^>]+?src=["'](http[^'^"]+?)['"]''', 1)[0]
                subUrl = CParsingHelper.getSearchGroups(data, '''<track[^>]+?src=["'](http[^'^"]+?)['"]''', 1)[0]
                if 'youtube' in difSourcesSrc: 
                    return self.getYTVideoUrl(difSourcesSrc)
                else:
                    return [{'name':'AnyFiles.pl', 'url':url}]
        return []
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:43,代码来源:anyfilesapi.py

示例8: getFilmTab

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def getFilmTab(self, url, category, pager):
     sts, data = self.cm.getPage( url, {'header': self.HEADER } )
     if not sts: return 
     nextPage = re.search('<li><a href="/filmy?.+?" rel="next">&raquo;</a></li>', data)        
     data = CParsingHelper.getDataBeetwenMarkers(data, '<div class="row-fluid  movie-item">', '<div class="container">', False)[1]
     data = data.split('<div class="row-fluid  movie-item">')
     titleA = re.compile('<a class="title"[^>]+?>')
     titleB = re.compile('</small>')
     plotA  = re.compile('<p class="desc">')
     plotB  = re.compile('</div>')
     for item in data:
         title = CParsingHelper.getDataBeetwenReMarkers(item, titleA, titleB, False)[1]
         page  = self.MAINURL + CParsingHelper.getSearchGroups(item, 'class="title" href="([^"]+?)"', 1)[0]
         plot  = CParsingHelper.getDataBeetwenReMarkers(item, plotA, plotB, False)[1]
         img   = CParsingHelper.getSearchGroups(item, 'src="([^"]+?)"', 1)[0]
         if '' != title and '' != page:
             params = {'title': title, 'page': page, 'icon': img, 'plot': plot}
             self.addVideo(params)
     if nextPage:
         params = {'name': 'nextpage', 'category': category, 'title': 'Następna strona', 'page': str(int(pager) + 1)}
         self.addDir(params)
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:23,代码来源:hostkinoman.py

示例9: __addLastVersion

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def __addLastVersion(self, servers):
     mainUrl = "https://gitorious.org/iptvplayer-for-e2/iptvplayer-for-e2"
     sts, response = self.cm.getPage(mainUrl, {'return_data':False})
     if sts:
         finalurl = response.geturl()
         printDBG("UpdateMainAppImpl.__addLastVersion finalurl[%s]" % finalurl)
         response.close()
         crcSum = finalurl.split('/')[-1].replace(':', '')
         if 40 == len(crcSum):
             sts, data = self.cm.getPage(finalurl + "IPTVPlayer/version.py")
             if sts:
                 newVerNum = CParsingHelper.getSearchGroups(data, '&quot;([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)&quot;')[0]
                 sourceUrl = mainUrl + "/archive/%s.tar.gz" % crcSum
                 server = {'name':'gitorious.org', 'version':newVerNum, 'url':sourceUrl, 'subdir':'iptvplayer-for-e2-iptvplayer-for-e2/', 'pyver':'X.X', 'packagetype':'sourcecode'}
                 printDBG("UpdateMainAppImpl.__addLastVersion server: [%s]" % str(server))
                 servers.append(server)
         else:
             printDBG("Wrong crcSum[%s]" % crcSum)
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:20,代码来源:updatemainwindow.py

示例10: checkVersionFile

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
    def checkVersionFile(self, newVerPath):
        code = 0
        msg  = 'Wersja poprawna.'
        
        newVerFile = os_path.join(newVerPath, 'version.py')
        if os_path.isfile(newVerFile):
            verPattern = self.VERSION_PATTERN
        else:
            newVerFile = os_path.join(newVerPath, 'version.pyo')
            verPattern = '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'

        try:
            # get new version
            with open (newVerFile, "r") as verFile: data = verFile.read()
            newVerNum = CParsingHelper.getSearchGroups(data, verPattern)[0]
            if newVerNum != self.serversList[self.currServIdx]['version']:
                code = -1
                msg  = _("Wrong version. \n downloaded version [%s] is different from the requested [%s].") % (newVerNum, self.serversList[self.currServIdx]['version'])
        except:
            printExc()
            code = -1
            msg  = _("File [%s] reading failed.") % newVerFile
        return code, msg
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:25,代码来源:updatemainwindow.py

示例11: getLinks

# 需要导入模块: from Plugins.Extensions.IPTVPlayer.libs.pCommon import CParsingHelper [as 别名]
# 或者: from Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper import getSearchGroups [as 别名]
 def getLinks(self, url, lang, playerType):
     printDBG("getLinks lang[%r], playerType[%r]" % (lang, playerType) )
     hostingTab = []
     HEADER = dict(self.AJAX_HEADER)
     HEADER['Referer'] = url
     if 'free' == playerType['val']:
         http_params = {'header': HEADER}
     else:
         http_params = {'header': HEADER, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE}
     #post_data = { 'action': 'getPlayer', 'lang': lang['val'], 'playerType': playerType['val'] }
     post_data = { 'action': 'getPlayer', 'id': lang['val'], 'setHosting': '1' }
     
     sts, data = self.cm.getPage( url, http_params, post_data)
     if not sts or 'Player premium jest dostępny tylko dla' in data: 
         return hostingTab
     
     # get players ID
     playersData = CParsingHelper.getDataBeetwenMarkers(data, '<div class="services">', '</div>', False)[1]
     playersData = re.compile('data-id="([0-9]+?)" data-playertype="([^"]+?)"[^>]*?>([^<]+?)</a>').findall(data)
     for item in playersData:
         tmp = {'need_resolve':1, 'name': '%s|%s|%s' % (lang['title'].ljust(16), playerType['title'].center(12), item[2].strip().rjust(14)), 'url': '%s|%s|%s' % (url, item[0], playerType['val']) }
         hostingTab.append(tmp)
      
     # new method to get premium links
     if 0 == len(hostingTab):
         sts, tmp = CParsingHelper.getDataBeetwenMarkers(data, 'newPlayer.init("', '")', False)
         try:
             tmp = CParsingHelper.getSearchGroups(data, 'id="%s" data-key="([^"]+?)"' % tmp)[0]
             tmp = base64.b64decode(tmp[2:])
             tmp = byteify( json.loads(tmp)['url'] )
             title = '%s | premium' % lang['title'].ljust(16)
             tmp = {'need_resolve':1, 'name': title, 'url': tmp}
             hostingTab.append(tmp)
             printDBG("||||||||||||||||||||||||||||||||||||%s|||||||||||||||||||||||||||||||" % tmp)
         except:
             printExc()
     return hostingTab
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:39,代码来源:hostplaytube.py


注:本文中的Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper.getSearchGroups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。