本文整理汇总了Python中Plugins.Extensions.IPTVPlayer.libs.pCommon.CParsingHelper类的典型用法代码示例。如果您正苦于以下问题:Python CParsingHelper类的具体用法?Python CParsingHelper怎么用?Python CParsingHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CParsingHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getLinksForVideo
def getLinksForVideo(self, cItem):
printDBG("MoviesHDCO.getLinksForVideo [%s]" % cItem)
urlTab = []
sts, data = self.getPage(cItem['url'])
if not sts: return urlTab
#printDBG(data)
data = CParsingHelper.getDataBeetwenMarkers(data, '<div class="video-embed">', '</div>', False)[1]
oneLink = CParsingHelper.getDataBeetwenMarkers(data, 'data-rocketsrc="', '"', False)[1]
if oneLink == '': oneLink = self.cm.ph.getSearchGroups(data, '<iframe[^>]+?src="([^"]+?)"')[0]
if oneLink == '': oneLink = self.cm.ph.getSearchGroups(data, '<script[^>]+?src="([^"]+?)"')[0]
if oneLink.startswith('//'):
oneLink = 'http:' + oneLink
oneLink = self._getFullUrl(oneLink)
if 'videomega.tv/validatehash.php?' in oneLink:
sts, data = self.cm.getPage(oneLink, {'header':{'Referer':cItem['url'], 'User-Agent':'Mozilla/5.0'}})
if not sts: return urlTab
data = self.cm.ph.getSearchGroups(data, 'ref="([^"]+?)"')[0]
if '' == data: return urlTab
oneLink = 'http://videomega.tv/view.php?ref={0}&width=700&height=460&val=1'.format(data)
if '' == oneLink: return urlTab
name = self.up.getHostName(oneLink)
urlTab.append({'name':name, 'url':oneLink, 'need_resolve':1})
return urlTab
示例2: getLink
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
示例3: getTeamCastList
def getTeamCastList(self, cItem):
printDBG('getTeamCastList start')
#http://team-cast.pl.cp-21.webhostbox.net/kanalyFlash/
#http://team-cast.pl.cp-21.webhostbox.net/
#src="http://team-cast.pl.cp-21.webhostbox.net/kanalyFlash/film/hbo.html"
url = cItem['url']
# list categories
if '' == url :
self.teamCastTab = {}
url = 'http://team-cast.pl.cp-21.webhostbox.net/'
sts, data = self.cm.getPage(url)
if not sts: return
data = CParsingHelper.getDataBeetwenMarkers(data, '<div id="stream-frame">', '<div id="now-watching">', False)[1]
# remove commented channels
data = re.sub('<!--[^!]+?-->', '', data)
data = data.split('<li class="menu_right">')
del data[0]
for cat in data:
catName = CParsingHelper.getDataBeetwenMarkers(cat, '<a href="#" class="drop">', '</a>', False)[1].strip()
channels = re.findall('<a href="([^"]+?)">([^<]+?)<img src="http://wrzucaj.net/images/2014/09/12/flash-player-icon.png"', cat)
if len(channels):
self.teamCastTab[catName] = channels
newItem = dict(cItem)
newItem.update({'url':catName, 'title':catName + ' (%d)' % len(channels)})
self.addDir(newItem)
elif url in self.teamCastTab:
# List channels
for item in self.teamCastTab[url]:
newItem = dict(cItem)
newItem.update({'url':item[0], 'title':item[1]})
self.playVideo(newItem)
else:
printExc()
示例4: __init__
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
示例5: getWebCamera
def getWebCamera(self, cItem):
printDBG("getWebCamera start")
sts, data = self.cm.getPage(cItem['url'])
if sts:
if cItem['title'] == 'WebCamera PL':
params = dict(cItem)
params.update({'title':'Polecane kamery'})
self.addDir(params)
data = CParsingHelper.getDataBeetwenMarkers(data, '<h4>Kamery wg kategorii</h4>', '</div>', False)[1]
data = data.split('</a>')
del data[-1]
for item in data:
url = self.cm.ph.getSearchGroups(item, """href=['"](http[^'^"]+?)['"]""")[0]
if '' != url:
params = dict(cItem)
params.update({'title':self._cleanHtmlStr(item), 'url':url})
self.addDir(params)
else:
data = CParsingHelper.getDataBeetwenMarkers(data, '<div class="inlinecam', '<div id="footerbar">', False)[1]
data = data.split('<div class="inlinecam')
for item in data:
item = CParsingHelper.getDataBeetwenMarkers(item, '<a', '</div>', True)[1]
url = self.cm.ph.getSearchGroups(item, """href=['"](http[^'^"]+?)['"]""")[0]
if '' != url:
title = self._cleanHtmlStr(CParsingHelper.getDataBeetwenMarkers(item, '<div class="bar">', '</div>', False)[1])
icon = self.cm.ph.getSearchGroups(item, """data-src=['"](http[^'^"]+?)['"]""")[0]
params = dict(cItem)
params.update({'title':title, 'url':url, 'icon':icon})
self.playVideo(params)
示例6: fillFilters
def fillFilters(self, refresh=False):
printDBG('getFilters')
def SetFilters(raw, tab):
printDBG("---------------------")
for it in raw:
tab.append({'tab': it[1], 'val': it[0]})
printDBG("filter: %r" % tab[-1])
if self.filtersFilled and not refresh:
return False
sts, data = self.cm.getPage(self.MAINURL)
if False == sts:
return
rawSortFilters = CParsingHelper.getDataBeetwenMarkers(data, 'Sortuj:', '</div>', False)[1]
rawVerFilters = CParsingHelper.getDataBeetwenMarkers(data, 'Wyświetl:', '</div>', False)[1]
rawCatFilters = CParsingHelper.getDataBeetwenMarkers(data, 'Kategorie Filmowe', '<script>', False)[1]
data = '' # free data ;)
rawSortFilters = re.compile('href="[^,]+?\,([^,]+?)\,wszystkie,0\.html">([^<]+?)<').findall(rawSortFilters)
rawVerFilters = re.compile('href="[^,]+?\,[^,]+?\,([^,]+?),0\.html">([^<]+?)<').findall(rawVerFilters)
rawCatFilters = re.compile('href="([^,]+?\,[^.]+?)\.html">([^<]+?)<').findall(rawCatFilters)
if 0 < len(rawSortFilters) and 0 < len(rawVerFilters) and 0 < len(rawCatFilters):
self.filters['sort'] = []
self.filters['ver'] = []
self.filters['cat'] = [{'tab': 'Wszystkie', 'val': 'glowna'}]
SetFilters(rawSortFilters, self.filters['sort'])
SetFilters(rawVerFilters, self.filters['ver'])
SetFilters(rawCatFilters, self.filters['cat'])
self.filtersFilled = True
示例7: getVideosList
def getVideosList(self, url):
printDBG("getVideosList url[%s]" % url)
sts, data = self.cm.getPage(url)
if not sts:
printDBG("getVideosList except")
return
# get pagination HTML part
nextPageData = CParsingHelper.getDataBeetwenMarkers(data, 'class="pager"', '</div>', False)[1]
# get Video HTML part
data = CParsingHelper.getDataBeetwenMarkers(data, '<!-- ************ end user menu ************ -->', '</ul>', False)[1].split('<li>')
del data[0]
for videoItemData in data:
printDBG(' videoItemData')
icon = ''
duration = ''
gatunek = ''
plot = ''
title = ''
url = ''
if 'class="playIcon"' in videoItemData:
# get icon src
match = re.search('src="(http://[^"]+?)"', videoItemData)
if match: icon = match.group(1).replace('&', '&')
# get duration
match = re.search('class="duration"[^>]*?>([^<]+?)<', videoItemData)
if match: duration = match.group(1).replace(''', "'")
# get gatunek
match = re.search('"gatunek"[^>]*?>([^<]+?)<', videoItemData)
if match: gatunek = match.group(1)
# get plot
match = re.search('class="text"[^>]*?>([^<]+?)<', videoItemData)
if match: plot = match.group(1)
# get title and url
match = re.search('<a href="([^"]+?)" class="title"[^>]*?>([^<]+?)</a>', videoItemData)
if match:
url = self.MAIN_URL + match.group(1)
title = match.group(2)
params = {'type': 'video', 'page': url, 'title': title, 'icon': icon, 'duration': duration, 'gatunek': gatunek, 'plot': plot}
self.currList.append( params )
# check next page
nextPageUrl = ''
match = re.search('href="([^"]+?)" class="nextPage"', nextPageData)
if match:
nextPageUrl = match.group(1)
else:
match = re.search('href="([^"]+?)" class="lastPage"', nextPageData)
if match:
nextPageUrl = match.group(1)
if '' != nextPageUrl:
params = {'type': 'category', 'name': 'sub-category', 'page': self.MAIN_URL + nextPageUrl.replace('&', '&'), 'title': 'Następna strona'}
self.currList.append( params )
示例8: listsCategoriesMenu
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)
示例9: listSerialSeasons
def listSerialSeasons(self, category, url, icon):
printDBG("listSerialSeasons")
sts, data = self.cm.getPage( url )
if False == sts: return
plot = CParsingHelper.getDataBeetwenMarkers(data, '<p class="serialDescription">', '</p>', False)[1]
data = CParsingHelper.getDataBeetwenMarkers(data, '<div class="seasonExpand">', '<script>', False)[1]
data = re.compile('<a href="[/]?(serial,[^,]+?,sezon,[1-9][0-9]*?.html)">([^<]+?)</a>').findall(data)
for item in data:
if not item[0].startswith('http'):
url = self.MAINURL + item[0]
params = {'name': 'category', 'title': item[1], 'category': category, 'url': url, 'icon':icon, 'plot':plot}
self.addDir(params)
示例10: listSearchResults
def listSearchResults(self, pattern, searchType):
printDBG("listFilms pattern[%s], searchType[%s]" % (pattern, searchType))
url = self.MAINURL + 'szukaj.html?query=%s&mID=' % pattern
sts, data = self.cm.getPage( url )
if False == sts: return
if 'filmy' == searchType:
sts, data = CParsingHelper.getDataBeetwenMarkers(data, '<h2 id="movies-res">Filmy:', '<a href="#top"', False)
category = 'video'
else:
sts, data = CParsingHelper.getDataBeetwenMarkers(data, '<h2 id="serials-res">Seriale:', '<a href="#top"', False)
category = 'Serial_seasons_list'
data = data.split('<li data-url=')
self.listItems(data, category)
示例11: getArticleContent
def getArticleContent(self, cItem):
printDBG("Filmy3dEU.getArticleContent [%s]" % cItem)
retTab = []
if 'url' not in cItem: return retTab
sts, data = self.cm.getPage(cItem['url'])
if not sts: return retTab
sts, data = CParsingHelper.getDataBeetwenMarkers(data, "<div id='dle-content'>", '<div class="gf-right">', False)
title = CParsingHelper.getDataBeetwenMarkers(data, '<h1 class="title">', '</h1>', False)[1]
icon = self.cm.ph.getSearchGroups(data, 'srct="([^"]+?)"')[0]
desc = self.cleanHtmlStr( self.cm.ph.getDataBeetwenMarkers(data, '<div class="comment-box-block" id="comment1">', '</div>', False)[1] )
return [{'title':title, 'text':desc, 'images':[]}]
示例12: getVideoUrl
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 []
示例13: getF4MLinksWithMeta
def getF4MLinksWithMeta(manifestUrl, checkExt=True):
if checkExt and not manifestUrl.split("?")[0].endswith(".f4m"):
return []
cm = common()
headerParams, postData = cm.getParamsFromUrlWithMeta(manifestUrl)
retPlaylists = []
sts, data = cm.getPage(manifestUrl, headerParams, postData)
if sts:
liveStreamDetected = False
if "live" == CParsingHelper.getDataBeetwenMarkers("<streamType>", "</streamType>", False):
liveStreamDetected = True
bitrates = re.compile('bitrate="([0-9]+?)"').findall(data)
for item in bitrates:
link = strwithmeta(manifestUrl, {"iptv_proto": "f4m", "iptv_bitrate": item})
if liveStreamDetected:
link.meta["iptv_livestream"] = True
retPlaylists.append({"name": "[f4m/hds] bitrate[%s]" % item, "url": link})
if 0 == len(retPlaylists):
link = strwithmeta(manifestUrl, {"iptv_proto": "f4m"})
if liveStreamDetected:
link.meta["iptv_livestream"] = True
retPlaylists.append({"name": "[f4m/hds]", "url": link})
return retPlaylists
示例14: __addLastVersion
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, '"([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"')[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)
示例15: getArticleContent
def getArticleContent(self, cItem):
printDBG("MoviesHDCO.getArticleContent [%s]" % cItem)
retTab = []
if 'url' not in cItem: return []
sts, data = self.getPage(cItem['url'])
if not sts: return retTab
sts, data = CParsingHelper.getDataBeetwenMarkers(data, '<table id="imdbinfo">', '</table>', False)
if not sts: return retTab
tmp = data.split('</tr>')
if len(tmp) < 2: return retTab
title = self.cleanHtmlStr(tmp[0])
if '' == title: icon = self.cm.ph.getSearchGroups(tmp[1], 'alt="([^"]+?)"')[0]
icon = self.cm.ph.getSearchGroups(tmp[1], 'src="([^"]+?)"')[0]
desc = self.cm.ph.getDataBeetwenMarkers(tmp[1], '<b>Plot:</b>', '</td>', False)[1]
otherInfo = {}
tmpTab = [{'mark':'<b>Rating:</b>', 'key':'rating'},
{'mark':'<b>Director:</b>', 'key':'director'},
{'mark':'<b>Writer:</b>', 'key':'writer'},
{'mark':'<b>Stars:</b>', 'key':'stars'},
{'mark':'<b>Runtime:</b>', 'key':'duration'},
{'mark':'<b>Rated:</b>', 'key':'rated'},
{'mark':'<b>Genre:</b>', 'key':'genre'},
{'mark':'<b>Released:</b>', 'key':'released'},
]
for item in tmpTab:
val = self.cm.ph.getDataBeetwenMarkers(tmp[1], item['mark'], '</td>', False)[1]
if '' != val: otherInfo[item['key']] = self.cleanHtmlStr(val)
return [{'title':self.cleanHtmlStr( title ), 'text': self.cleanHtmlStr( desc ), 'images':[{'title':'', 'url':self._getFullUrl(icon)}], 'other_info':otherInfo}]