本文整理汇总了Python中Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper.getRedirectedUrl方法的典型用法代码示例。如果您正苦于以下问题:Python TwAgentHelper.getRedirectedUrl方法的具体用法?Python TwAgentHelper.getRedirectedUrl怎么用?Python TwAgentHelper.getRedirectedUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper
的用法示例。
在下文中一共展示了TwAgentHelper.getRedirectedUrl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRedirectedUrl
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
def getRedirectedUrl():
def getUrl(result, err=False):
if not err:
global redirected_url
redirected_url = result
tw_agent_hlp = TwAgentHelper(redir_agent=False)
tw_agent_hlp.getRedirectedUrl(BASE_URL).addCallback(getUrl).addErrback(getUrl, True)
示例2: IStreamStreams
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
print "loadPage:"
streamUrl = self.filmUrl
# print "FilmUrl: %s" % self.filmUrl
# print "FilmName: %s" % self.filmName
self.tw_agent_hlp.getWebPage(self.parseData, self.dataError, streamUrl, False)
def parseData(self, data):
print "parseData:"
streams = re.findall('a class="hoster-button.*?href="(.*?)".*?title=".*?\[(.*?)\](.*?)"', data)
mdesc = re.search('class="desc">(.*?)<br />', data, re.S)
if mdesc:
print "Descr. found"
desc = mdesc.group(1).strip()
else:
desc = "Keine weiteren Info's !"
self.streamListe = []
if streams:
print "Streams found"
for (isUrl, isStream, streamPart) in streams:
if re.match(
".*?(putlocker|sockshare|streamclou|xvidstage|filenuke|movreel|nowvideo|xvidstream|uploadc|vreer|MonsterUploads|Novamov|Videoweed|Divxstage|Ginbig|Flashstrea|Movshare|yesload|faststream|Vidstream|PrimeShare|flashx|Divxmov|Putme|Click.*?Play|BitShare)",
isStream,
re.S | re.I,
):
# print isUrl
# print isStream,streamPart
self.streamListe.append((isStream, isUrl, streamPart))
else:
print "No supported hoster:"
print isStream
print isUrl
else:
print "No Streams found"
self.streamListe.append(("No streams found!", "", ""))
self.streamMenuList.setList(map(IStreamStreamListEntry, self.streamListe))
self["handlung"].setText(decodeHtml(desc))
self.keyLocked = False
print "imageUrl: ", self.imageUrl
CoverHelper(self["coverArt"]).getCover(self.imageUrl)
def dataError(self, error):
print "dataError:"
printl(error, self, "E")
self.streamListe.append(("Read error !", ""))
self.streamMenuList.setList(map(IStreamStreamListEntry, self.streamListe))
def got_link(self, stream_url):
print "got_link:"
if stream_url == None:
message = self.session.open(
MessageBox, _("Stream not found, try another Stream Hoster."), MessageBox.TYPE_INFO, timeout=3
)
else:
title = self.filmName + self["liste"].getCurrent()[0][2]
if config.mediaportal.useHttpDump.value:
movieinfo = [stream_url, self.filmName, ""]
self.session.open(PlayHttpMovie, movieinfo, title)
else:
self.session.open(
SimplePlayer,
[(title, stream_url, self.imageUrl)],
cover=True,
showPlaylist=False,
ltype="istream.ws",
)
def keyTMDbInfo(self):
if TMDbPresent:
self.session.open(TMDbMain, self.filmName)
elif IMDbPresent:
self.session.open(IMDB, self.filmName)
def keyOK(self):
if self.keyLocked:
return
streamLink = self["liste"].getCurrent()[0][1]
self.tw_agent_hlp.getRedirectedUrl(self.keyOK2, self.dataError, streamLink)
def keyOK2(self, streamLink):
saveads = re.search(".*?saveads.org", streamLink, re.S)
if saveads:
id = re.search("url=(.*?)%3D", streamLink, re.S)
url = "http://istream.ws/go.php?url=" + id.group(1)
self.tw_agent_hlp.getRedirectedUrl(self.keyOK3, self.dataError, url)
else:
get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyOK3(self, streamLink):
get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyTxtPageUp(self):
self["handlung"].pageUp()
def keyTxtPageDown(self):
self["handlung"].pageDown()
def keyCancel(self):
self.close()
示例3: gstreaminxxxStreamListeScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class gstreaminxxxStreamListeScreen(Screen):
def __init__(self, session, streamFilmLink, streamName):
self.session = session
self.streamFilmLink = streamFilmLink
self.streamName = streamName
path = "/usr/lib/enigma2/python/Plugins/Extensions/MediaPortal/skins/%s/XXXGenreScreen.xml" % config.mediaportal.skin.value
if not fileExists(path):
path = "/usr/lib/enigma2/python/Plugins/Extensions/MediaPortal/skins/original/XXXGenreScreen.xml"
print path
with open(path, "r") as f:
self.skin = f.read()
f.close()
Screen.__init__(self, session)
self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", "NumberActions", "MenuActions", "EPGSelectActions"], {
"ok" : self.keyOK,
"cancel": self.keyCancel
}, -1)
self['title'] = Label("G-Stream.in")
self['name'] = Label('Bitte warten...')
self['coverArt'] = Pixmap()
self.tw_agent_hlp = TwAgentHelper()
self.keyLocked = True
self.filmliste = []
self.chooseMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self.chooseMenuList.l.setFont(0, gFont('mediaportal', 23))
self.chooseMenuList.l.setItemHeight(25)
self['genreList'] = self.chooseMenuList
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
getPage(self.streamFilmLink, agent=special_headers, headers={'Cookie': 'sitechrx='+sitechrx+'; overkill_in='+str(time())}).addCallback(self.loadPageData).addErrback(self.dataError)
def dataError(self, error):
printl(error,self,"E")
def loadPageData(self, data):
print "daten bekommen"
raw = re.findall('<table\sid="post[0-9]+"(.*?)id="post_thanks_box', data, re.S)
streams = re.findall('"(http://.*?(g-stream.in\/secure\/.*?\/|flashx|[w]+.putlocker|[w]+.sockshare|vidx.to|.).*?)"', raw[0], re.S)
if streams:
for (stream, hostername) in streams:
if re.match('.*?(vidx|putlocker|sockshare|streamclou|xvidstage|filenuke|movreel|nowvideo|xvidstream|uploadc|vreer|MonsterUploads|Novamov|Videoweed|Divxstage|Ginbig|Flashstrea|Movshare|yesload|faststream|Vidstream|PrimeShare|flashx|Divxmov|Putme|BitShare)', hostername.strip(' '), re.S|re.I):
print hostername, stream
if hostername == 'flashx':
hostername = 'Flashx'
if hostername == 'www.putlocker':
hostername = 'Putlocker'
if hostername == 'www.sockshare':
hostername = 'Sockshare'
hostername = hostername.replace('g-stream.in/secure/streamcloud.eu/', 'Streamcloud (Secure)')
hostername = hostername.replace('g-stream.in/secure/flashx.tv/', 'Flashx (Secure)')
hostername = hostername.replace('g-stream.in/secure/www.putlocker.com/', 'Putlocker (Secure)')
hostername = hostername.replace('g-stream.in/secure/www.sockshare.com/', 'Sockshare (Secure)')
self.filmliste.append((hostername, stream))
if len(self.filmliste) < 1:
self.filmliste.append(('Keine Streams gefunden.', None))
self.filmliste = list(set(self.filmliste))
self.filmliste.sort()
self.chooseMenuList.setList(map(gstreaminxxxHosterListEntry, self.filmliste))
self['name'].setText(self.streamName)
self.keyLocked = False
def keyOK(self):
if self.keyLocked:
return
streamLink = self['genreList'].getCurrent()[0][1]
streamHoster = self['genreList'].getCurrent()[0][0]
if streamLink == None:
return
url = streamLink
url = url.replace('&','&')
print 'Hoster: ' + streamHoster
print 'URL: ' + url
self['name'].setText('Bitte warten...')
if streamHoster == 'Flashx':
print 'Direct Play'
self.get_stream(url)
elif streamHoster == 'Putlocker':
print 'Direct Play'
self.get_stream(url)
elif streamHoster == 'Sockshare':
print 'Direct Play'
self.get_stream(url)
else:
print 'Secured Play'
self.tw_agent_hlp.headers.addRawHeader('Referer','http://g-stream.in')
self.tw_agent_hlp.getRedirectedUrl(self.get_stream, self.dataError, streamLink)
def get_stream(self,url):
get_stream_link(self.session).check_link(url, self.got_link)
def got_link(self, stream_url):
self['name'].setText(self.streamName)
#.........这里部分代码省略.........
示例4: StreamAuswahl
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
Title = self['liste'].getCurrent()[0][1]
self.session.open(StreamAuswahl, Link, Title)
class StreamAuswahl(MPScreen):
def __init__(self, session, Title, Link):
self.Link = Link
self.Title = Title
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListWideScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListWideScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
self["actions"] = ActionMap(["MP_Actions"], {
"ok" : self.keyOK,
"0" : self.closeAll,
"cancel": self.keyCancel
}, -1)
self['title'] = Label(basename)
self['ContentTitle'] = Label("%s" %self.Title)
self.filmliste = []
self.keyLocked = True
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
self.keyLocked = True
url = self.Link
getPage(url, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.loadPageData).addErrback(self.dataError)
def loadPageData(self, data):
parse = re.search('class="wordpress-post-tabs(.*?)class="wpts_cr', data, re.S)
if parse:
streamsids = re.findall('#tabs-(.*?)".*?(><a href="(http[s]?://(.*?)\/.*?)" target="_blank"|)>((?!<s).*?)<', parse.group(1), re.S)
if streamsids:
for (id, x, link, hoster, quality) in streamsids:
if not link:
stream = re.findall('id="tabs-'+id+'.*?="(http[s]?://(.*?)\/.*?)"', parse.group(1), re.S)
if stream:
if isSupportedHoster(stream[0][1], True):
hoster = '%s - %s' % (quality, stream[0][1].replace('wtf-is-this.xyz', 'WTFISTHIS redirect'))
self.filmliste.append((hoster, stream[0][0]))
else:
hoster = '%s - %s' % (quality, hoster.replace('wtf-is-this.xyz', 'WTFISTHIS redirect'))
self.filmliste.append((hoster, link))
else:
streamsids = re.findall('center;">.*?<strong>(\w.*?)<.*?<iframe\ssrc="(http[s]?://(.*?)\/.*?)"', data, re.S)
if streamsids:
for (quality, link, hoster) in streamsids:
if isSupportedHoster(hoster, True) or hoster == 'wtf-is-this.xyz':
hoster = '%s - %s' % (quality, hoster.replace('wtf-is-this.xyz', 'WTFISTHIS redirect'))
self.filmliste.append((hoster, link))
if len(self.filmliste) == 0:
self.filmliste.append((_('No supported streams found!'), None))
self.ml.setList(map(self._defaultlisthoster, self.filmliste))
self.keyLocked = False
def keyOK(self):
if self.keyLocked:
return
streamHoster = self['liste'].getCurrent()[0][0]
url = self['liste'].getCurrent()[0][1]
if url == None:
return
if re.search('redirect', streamHoster):
getPage(url).addCallback(self.wtfisthis).addErrback(self.dataError)
else:
get_stream_link(self.session).check_link(url, self.got_link)
def wtfisthis(self, data):
url = re.search('<a href="(http://wtf-is-this.xyz/\?r=.*?)"', data, re.S)
if url:
url = url.group(1)
self.tw_agent_hlp = TwAgentHelper()
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.wtfisthisdata).addErrback(self.dataError)
else:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
def wtfisthisdata(self, data):
getPage(data, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.adfly).addErrback(self.dataError)
def adfly(self, data):
ysmm = re.search("var\sysmm\s=\s'(.*?)'", data)
if ysmm:
ysmm = ysmm.group(1)
left = ''
right = ''
for c in [ysmm[i:i+2] for i in range(0, len(ysmm), 2)]:
left += c[0]
#.........这里部分代码省略.........
示例5: megaskanksStreamListeScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
elif re.search('http.*?amy\.gs', url):
getPage(url, agent=spezialagent).addCallback(self.allanal, url).addErrback(self.dataError)
def adfly(self, data):
ysmm = re.search("var\sysmm\s=\s'(.*?)'", data)
if ysmm:
ysmm = ysmm.group(1)
left = ''
right = ''
for c in [ysmm[i:i+2] for i in range(0, len(ysmm), 2)]:
left += c[0]
right = c[1] + right
url = base64.b64decode(left.encode() + right.encode())[2:].decode()
if re.search(r'go\.php\?u\=', url):
url = base64.b64decode(re.sub(r'(.*?)u=', '', url)).decode()
self.get_stream(str(url))
else:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
def adfoc(self, data):
link = re.findall('var\sclick_url\s=\s"(.*?)"', data, re.S)
if link:
self.get_stream(link[0])
else:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
def linkshrink(self, data, baseurl):
link = re.findall('<a\sclass="bt"\shref="(.*?)"', data)
if link:
url = link[0]
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
self.tw_agent_hlp.headers.addRawHeader('User-Agent', user_agent)
self.tw_agent_hlp.headers.addRawHeader('Referer', baseurl)
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.linkshrinkLink).addErrback(self.dataError)
def linkshrinkLink(self, url):
if url:
if re.search('(www.allanalpass.com|linkbucks.com|adfoc.us)', url):
self.checkStreamLink(url)
else:
self.get_stream(url)
else:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
def shst(self, data, baseurl):
session_id = re.findall('sessionId:\s"(.*?)"', data)
if session_id:
url = 'http://sh.st/shortest-url/end-adsession?adSessionId=%s' % (session_id[0])
reactor.callLater(6, self.shstData, url, baseurl)
message = self.session.open(MessageBoxExt, _("Stream starts in 6 sec."), MessageBoxExt.TYPE_INFO, timeout=6)
else:
self.stream_not_found()
def shstData(self, url, baseurl):
http_header = {
"Accept": "*/*",
"Accept-Encoding": "gzip,deflate",
"Accept-Language": "en-US,en;,q=0.8",
"Host": "sh.st",
"Referer": baseurl,
"Origin": "http://sh.st",
"X-Requested-With": "XMLHttpRequest"
}
getPage(url, agent=spezialagent, headers=http_header).addCallback(self.shstLink).addErrback(self.dataError)
def shstLink(self, data):
示例6: pornhiveStreamListeScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class pornhiveStreamListeScreen(MPScreen):
def __init__(self, session, streamFilmLink, streamName, streamImage):
self.streamFilmLink = streamFilmLink
self.streamName = streamName
self.streamImage = streamImage
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListWideScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListWideScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
self["actions"] = ActionMap(["MP_Actions"], {
"ok" : self.keyOK,
"0" : self.closeAll,
"cancel": self.keyCancel
}, -1)
self['title'] = Label(BASE_NAME)
self['ContentTitle'] = Label("Streams:")
self['name'] = Label(_("Please wait..."))
self.captchainfo = {}
self.filmliste = []
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
CoverHelper(self['coverArt']).getCover(self.streamImage)
self.keyLocked = True
self.filmliste = []
getPage(self.streamFilmLink).addCallback(self.loadPageData).addErrback(self.dataError)
def loadPageData(self, data):
streams = re.findall('data-id="(.*?)".*?Watch\sit\son\s+(.*?)"', data, re.S)
if streams:
for (streamid, hostername) in streams:
if isSupportedHoster(hostername, True):
self.filmliste.append((hostername, streamid))
if len(self.filmliste) == 0:
self.filmliste.append((_("No supported streams found!"), None))
self.ml.setList(map(self._defaultlisthoster, self.filmliste))
self.keyLocked = False
self['name'].setText(self.streamName)
def keyOK(self):
if self.keyLocked:
return
streamid = self['liste'].getCurrent()[0][1]
if streamid == None:
return
url = "%s/en/out/%s" % (BASE_URL, streamid)
self.tw_agent_hlp = TwAgentHelper()
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.test_streamLink).addErrback(self.dataError)
def test_streamLink(self, url):
if re.match(BASE_URL, url):
getPage(url).addCallback(self.get_streamLink).addErrback(self.dataError)
else:
get_stream_link(self.session).check_link(url, self.got_link)
def get_streamLink(self, data):
streams = re.search('<iframe\ssrc="(.*?)"', data, re.S|re.I)
if streams:
get_stream_link(self.session).check_link(streams.group(1), self.got_link)
else:
message = self.session.open(MessageBoxExt, _("Broken URL parsing, please report to the developers."), MessageBoxExt.TYPE_INFO, timeout=3)
def got_link(self, stream_url):
self.session.open(SimplePlayer, [(self.streamName, stream_url, self.streamImage)], showPlaylist=False, ltype='pornhive', cover=True)
示例7: gstreaminxxxStreamListeScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class gstreaminxxxStreamListeScreen(MPScreen):
def __init__(self, session, streamFilmLink, streamName, cover):
self.streamFilmLink = streamFilmLink
self.streamName = streamName
self.cover = cover
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
self["actions"] = ActionMap(["MP_Actions"], {
"ok" : self.keyOK,
"0" : self.closeAll,
"cancel": self.keyCancel
}, -1)
self['title'] = Label("GStream.to")
self['ContentTitle'] = Label(_("Stream Selection"))
self['name'] = Label(self.streamName)
self.tw_agent_hlp = TwAgentHelper()
self.keyLocked = True
self.filmliste = []
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
CoverHelper(self['coverArt']).getCover(self.cover)
self['name'].setText(_('Please wait...'))
twAgentGetPage(self.streamFilmLink, agent=special_headers, headers={'Cookie': 'sitechrx='+sitechrx+'; overkill_in='+str(time())}).addCallback(self.loadPageData).addErrback(self.dataError)
def loadPageData(self, data):
raw = re.search('<table\sid="post[0-9]+"(.*?)id="post_thanks_box', data, re.S)
raw = re.sub(r'<!-- 1<script type="text/javascript">jwplayer.key.*?</script>1 -->', "", raw.group(1))
streams = re.findall('href="(http://(?!gstream\.to/(mirror|img|images)/)(?!www.youtube.com)(?!www.filefactory)(gstream\.to/secure/|)(.*?)\/.*?)[\'|"|\&|<]', raw, re.S)
if streams:
for (stream, dummy, dummy2, hostername) in streams:
if isSupportedHoster(hostername, True):
hostername = hostername.replace('www.','').replace('embed.','')
self.filmliste.append((hostername, stream))
# remove duplicates
self.filmliste = list(set(self.filmliste))
if len(self.filmliste) == 0:
self.filmliste.append((_('No supported streams found!'), None))
self.ml.setList(map(self._defaultlisthoster, self.filmliste))
self['name'].setText(self.streamName)
self.keyLocked = False
def keyOK(self):
if self.keyLocked:
return
url = self['liste'].getCurrent()[0][1]
if url == None:
return
url = url.replace('&','&')
self['name'].setText(_('Please wait...'))
if re.match('.*?gstream.to/secure/', url, re.S|re.I):
print 'Secured Play'
self.tw_agent_hlp.headers.addRawHeader('Referer','http://gstream.to/')
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.get_stream).addErrback(self.dataError)
else:
print 'Direct Play'
self.get_stream(url)
def get_stream(self,url):
get_stream_link(self.session).check_link(url, self.got_link)
def got_link(self, stream_url):
self['name'].setText(self.streamName)
if stream_url == None:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
else:
self.session.open(SimplePlayer, [(self.streamName, stream_url)], showPlaylist=False, ltype='gstreaminxxx')
示例8: StreamAuswahl
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
self.ml.setList(map(self._defaultlisthoster, self.filmliste))
self.keyLocked = False
def keyOK(self):
if self.keyLocked:
return
streamHoster = self['liste'].getCurrent()[0][0]
url = self['liste'].getCurrent()[0][1]
if url == None:
return
if re.search('WTFZONE', streamHoster):
getPage(url).addCallback(self.wtfzoneembed).addErrback(self.dataError)
elif re.search('WTFISTHIS', streamHoster):
getPage(url).addCallback(self.wtfisthis).addErrback(self.dataError)
elif re.search('WTFCrypt', streamHoster):
getPage(url, headers={'Referer': self.Link}).addCallback(self.wtfcrypt).addErrback(self.dataError)
else:
get_stream_link(self.session).check_link(url, self.got_link)
def wtfcrypt(self, data):
key = re.search('document.write.*?\("(.*?)"', data)
if key:
wtfcode = re.sub('[^A-Za-z0-9\+\/\=]', '', key.group(1))
mycode = base64.b64decode(base64.b64decode(wtfcode))
key = re.search('document.write.*?\("(.*?)"', mycode)
if key:
wtfcode = re.sub('[^A-Za-z0-9\+\/\=]', '', key.group(1))
mycode2 = base64.b64decode(base64.b64decode(wtfcode))
stream_url = re.search('src="(http.*?)"', mycode2)
if stream_url:
stream_url = stream_url.group(1)
get_stream_link(self.session).check_link(str(stream_url), self.got_link)
return
message = self.session.open(MessageBoxExt, _("Broken URL parsing, please report to the developers."), MessageBoxExt.TYPE_INFO, timeout=3)
def wtfisthis(self, data):
url = re.search('<a href="(http://wtf-is-this.xyz/\?r=.*?)"', data, re.S)
if url:
url = url.group(1)
self.tw_agent_hlp = TwAgentHelper()
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.wtfisthisdata).addErrback(self.dataError)
else:
self.adfly(data)
def wtfisthisdata(self, data):
getPage(data).addCallback(self.adfly).addErrback(self.dataError)
def wtfisthisembed(self, data):
getPage(data).addCallback(self.adfly).addErrback(self.dataError)
def adfly(self, data):
ysmm = re.search("var\sysmm\s=\s'(.*?)'", data)
if ysmm:
ysmm = ysmm.group(1)
left = ''
right = ''
for c in [ysmm[i:i+2] for i in range(0, len(ysmm), 2)]:
left += c[0]
right = c[1] + right
url = base64.b64decode(left.encode() + right.encode())[2:].decode()
if re.search(r'go\.php\?u\=', url):
url = base64.b64decode(re.sub(r'(.*?)u=', '', url)).decode()
if re.search('wtf-zone\.xyz', url, re.S):
self.wtfzone(str(url))
return
else:
get_stream_link(self.session).check_link(str(url), self.got_link)
return
else:
link = re.findall('="(http://wtf-zone\.xyz/view.*?)"', data, re.S)
if link:
self.wtfzone(link[0])
return
message = self.session.open(MessageBoxExt, _("Broken URL parsing, please report to the developers."), MessageBoxExt.TYPE_INFO, timeout=3)
def wtfzone(self, url):
if re.search('wtf-zone\.xyz/embed', url, re.S):
link = url
else:
id = re.search('wtf-zone\.xyz/view/.*?/(.*?)$', url)
if id:
link = "http://wtf-zone.xyz/embed/%s" % str(id.group(1))
getPage(link).addCallback(self.wtfzonelink).addErrback(self.dataError)
def wtfzoneembed(self, data):
link = re.search('embedURL"\scontent="(.*?)"', data)
if link:
getPage(link.group(1)).addCallback(self.wtfzonelink).addErrback(self.dataError)
def wtfzonelink(self, data):
stream_url = re.findall('\s+src="(http://[^wtf\-zone\.xyz].*?)"', data)
if stream_url:
stream_url = stream_url[-1]
get_stream_link(self.session).check_link(str(stream_url), self.got_link)
else:
message = self.session.open(MessageBoxExt, _("Broken URL parsing, please report to the developers."), MessageBoxExt.TYPE_INFO, timeout=3)
def got_link(self, stream_url):
title = self.Title
self.session.open(SimplePlayer, [(self.Title, stream_url)], showPlaylist=False, ltype='wtfvideofree')
示例9: gstreaminxxxFilmScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class gstreaminxxxFilmScreen(MPScreen, ThumbsHelper):
def __init__(self, session, Link, Name, mode):
self.mode = mode
self.Link = Link
self.Name = Name
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
ThumbsHelper.__init__(self)
self["actions"] = ActionMap(["MP_Actions"], {
"ok" : self.keyOK,
"0" : self.closeAll,
"cancel" : self.keyCancel,
"5" : self.keyShowThumb,
"up" : self.keyUp,
"down" : self.keyDown,
"right" : self.keyRight,
"left" : self.keyLeft,
"nextBouquet" : self.keyPageUp,
"prevBouquet" : self.keyPageDown,
"green" : self.keyPageNumber
}, -1)
self['title'] = Label("GStream.to")
self['ContentTitle'] = Label(self.Name)
self['F2'] = Label(_("Page"))
self['Page'] = Label(_("Page:"))
self.keyLocked = True
self.page = 1
self.lastpage = 1
self.tw_agent_hlp = TwAgentHelper(redir_agent=True)
self.urlRedirected = ''
self.filmliste = []
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
self.keyLocked = True
self['name'].setText(_('Please wait...'))
self.filmliste = []
if re.search('Search', self.Name) or self.Name == 'HD Filme':
if self.urlRedirected =='':
if self.Name == 'HD Filme':
baseurl = 'http://gstream.to/search.php?do=process&prefixchoice[]=hd'
else:
if re.search('Entire Post', self.Name):
titleonly = 0
else:
titleonly = 1
if self.mode == "porn":
searchType = '661'
else:
searchType = '528'
baseurl = 'http://gstream.to/search.php?do=process&childforums=1&do=process&exactname=1&forumchoice[]=%s&query=%s&s=&securitytoken=guest&titleonly=%s' % (searchType,self.Link,titleonly)
self.tw_agent_hlp.headers.addRawHeader('Cookie', 'sitechrx='+sitechrx+'; overkill_in='+str(time()))
self.tw_agent_hlp.headers.addRawHeader('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31')
self.tw_agent_hlp.headers.addRawHeader('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.3')
self.tw_agent_hlp.headers.addRawHeader('Accept','text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
self.tw_agent_hlp.headers.addRawHeader('Accept-Language','de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4')
self.tw_agent_hlp.headers.addRawHeader('Referer','http://gstream.to/')
self.tw_agent_hlp.getRedirectedUrl(baseurl).addCallback(self.getRedirectedData).addErrback(self.dataError)
else:
self.getRedirectedData(self.urlRedirected)
else:
if self.mode == "porn":
baseurl = 'http://gstream.to/forumdisplay.php?s=&f=661&pp=20&sort=lastpost&order=desc&daysprune=-1&prefixid='
url = baseurl + "%s&page=%s" % (self.Link, str(self.page))
else:
url = 'http://gstream.to/forumdisplay.php?f=%s&pp=20&sort=lastpost&order=desc&page=%s' % (self.Link, str(self.page))
twAgentGetPage(url, agent=special_headers, followRedirect=False, headers={'Cookie': 'sitechrx='+sitechrx+'; overkill_in='+str(time())}).addCallback(self.loadData).addErrback(self.dataError)
def getRedirectedData(self, urlRedirected):
self.urlRedirected = urlRedirected
url = self.urlRedirected + "&page=%s" % str(self.page)
twAgentGetPage(url, agent=special_headers, headers={'Cookie': 'sitechrx='+sitechrx+'; overkill_in='+str(time())}).addCallback(self.loadData).addErrback(self.dataError)
def loadData(self, data):
self.getLastPage(data, '', 'normal">Seite.*?von\s(.*?)</td>')
Movies = re.findall('class="p1"\shref="(.*?)".*?class="large"\ssrc="(.*?)".*?thread_title_[0-9]+".*?>(.*?)</a>', data, re.S)
if Movies:
for (Url, Image, Title) in Movies:
if Title != "DE. MILFs brauchen anonymen Sex!":
Url = Url.replace('&','&')
Url = 'http://gstream.to/' + Url
if re.search('images-box.com|rapidimg.org|your-imag.es|pics-traderz.org|imgload.biz|lulzimg.com|shareimage.me|pic.ms', str(Image), re.S):
#.........这里部分代码省略.........
示例10: SubStreamAuswahl
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class SubStreamAuswahl(MPScreen):
def __init__(self, session, Title, Hoster, Data):
self.Title = Title
self.Hoster = Hoster
self.Data = Data
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
self["actions"] = ActionMap(["MP_Actions"], {
"ok" : self.keyOK,
"0" : self.closeAll,
"cancel": self.keyCancel
}, -1)
self['title'] = Label("alluc.to / Filter: %s" % config.mediaportal.alluc_country.value)
self['ContentTitle'] = Label("Streamlist %s" %self.Title)
self.keyLocked = True
self.tw_agent_hlp = TwAgentHelper()
self.filmliste = []
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
streamparts = re.split('collinkname', self.Data )
for streampart in streamparts[1:]:
hits = re.findall('class="openlink.*?>(.*?)<.*?openlink.*?href="(.*?)".*?ratingscore.*?>(.*?)<.*?Hits">(.*?)<', streampart, re.S)
if hits:
url = "http://dir.alluc.to/%s" % hits[0][1]
self.filmliste.append((self.Hoster, hits[0][0].strip(), url, hits[0][2].strip(), hits[0][3].strip()))
if len(self.filmliste) == 0:
self.filmliste.append((None, _('No supported streams found!'), '', '', ''))
self.ml.setList(map(self.allucSubHostersEntry, self.filmliste))
self.keyLocked = False
def keyOK(self):
if self.keyLocked:
return
url = self['liste'].getCurrent()[0][2]
self['name'].setText(_("Please wait..."))
if url == None:
return
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
self.tw_agent_hlp.headers.addRawHeader('User-Agent', user_agent)
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.get_redirect).addErrback(self.dataError)
self['name'].setText("%s" % self.Title)
def get_redirect(self, url):
get_stream_link(self.session).check_link(url, self.got_link)
def got_link(self, stream_url):
if stream_url == None:
message = self.session.open(MessageBoxExt, _("Stream not found, try another Stream Hoster."), MessageBoxExt.TYPE_INFO, timeout=3)
else:
self.session.open(SimplePlayer, [(self.Title, stream_url)], showPlaylist=False, ltype='alluc')
示例11: arteSecondScreen
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
self.chooseMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self.chooseMenuList.l.setFont(0, gFont('mediaportal', 23))
self.chooseMenuList.l.setItemHeight(25)
self['liste'] = self.chooseMenuList
self.page = 0
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
getPage(self.Link, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.parseData).addErrback(self.dataError)
def parseData(self, data):
videos = re.findall('<div class="video">.*?<a href="(.*?)"><img alt=.*?" class=.*?" width=.*?" height=.*?" src="(.*?)".*?<p class="teaserText">(.*?)</p>.*?<h2><a href=".*?">(.*?)</a></h2>.*?<p>(.*?)</p>', data, re.S)
if videos:
self.filmliste = []
for (link, image, handlung, title, datum) in videos:
title = "%s - %s" % (datum ,decodeHtml(title))
link = "http://videos.arte.tv%s" % link
image = "http://videos.arte.tv%s" % image
self.filmliste.append((title, link, image, handlung))
self.chooseMenuList.setList(map(arteEntry1, self.filmliste))
self.keyLocked = False
self.showInfos()
def dataError(self, error):
printl(error,self,"E")
def showInfos(self):
self.ImageUrl = self['liste'].getCurrent()[0][2]
handlung = self['liste'].getCurrent()[0][3]
self['handlung'].setText(decodeHtml(handlung))
CoverHelper(self['coverArt']).getCover(self.ImageUrl)
def keyPageDown(self):
print "PageDown"
if self.keyLocked:
return
if not self.page < 1:
self.page -= 1
self.loadPage()
def keyPageUp(self):
print "PageUP"
if self.keyLocked:
return
self.page += 1
self.loadPage()
def keyLeft(self):
if self.keyLocked:
return
self['liste'].pageUp()
self.showInfos()
def keyRight(self):
if self.keyLocked:
return
self['liste'].pageDown()
self.showInfos()
def keyUp(self):
if self.keyLocked:
return
self['liste'].up()
self.showInfos()
def keyDown(self):
if self.keyLocked:
return
self['liste'].down()
self.showInfos()
def keyOK(self):
if self.keyLocked:
return
self.title = self['liste'].getCurrent()[0][0]
link = self['liste'].getCurrent()[0][1].replace('&','&')
print self.title, link
api_url = "http://www.arte.tv/player/v2//index.php?json_url=http://arte.tv/papi/tvguide/videos/stream/player/D/049880-014_PLUS7-D/ALL/ALL.json&lang=de_DE&config=arte_tvguide&rendering_place=" + str(link)
print api_url
getPage(api_url, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.getDataStream).addErrback(self.dataError)
def getDataStream(self, data):
guide_url = '<link rel="alternate" hreflang="de" href="(.*?)" />'
if guide_url:
print guide_url
getPage(guide_url[0], headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.getStream).addErrback(self.dataError)
def getDataStream(self, data):
stream_url = re.findall('<meta name="twitter:player:stream" content="(.*?)">', data)
if stream_url:
self.tw_agent_hlp.getRedirectedUrl(self.playStream, self.dataError, stream_url[0])
def playStream(self, url):
print url
self.session.open(SimplePlayer, [(self.title, url, self.ImageUrl)], showPlaylist=False, ltype='Arte')
def keyCancel(self):
self.close()
示例12: streamitStreams
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
self.trailerId = m.group(1).split('/')[-1]
except:
pass
else:
self['F2'].setText('Trailer')
mdesc = re.search('\s{4}(.*?…)',data)
if mdesc:
print "Descr. found"
desc = mdesc.group(1).strip()
else:
desc = "Keine weiteren Info's !"
#print desc
self.streamListe = []
if streams:
print "Streams found"
for (isUrl,isStream) in streams:
if re.search('(putlocker|sockshare|streamclou|xvidstage|filenuke|movreel|nowvideo|xvidstream|uploadc|vreer|MonsterUploads|Novamov|Videoweed|Divxstage|Ginbig|Flashstrea|Movshare|yesload|faststream|Vidstream|PrimeShare|flashx|Divxmov|Putme|Click.*?Play|BitShare)', isStream, re.S|re.I):
streamPart = ''
isUrl = isUrl.replace('\n','')
isUrl = isUrl.replace('\r','')
print isUrl
print isStream,streamPart
self.streamListe.append((isStream,isUrl,streamPart))
else:
print "No supported hoster:"
print isStream
print isUrl
else:
print "No Streams found"
self.streamListe.append(("No streams found!","",""))
self.streamMenuList.setList(map(streamitStreamListEntry, self.streamListe))
self['handlung'].setText(decodeHtml(desc))
self.keyLocked = False
print "imageUrl: ",self.imageUrl
CoverHelper(self['coverArt']).getCover(self.imageUrl)
def dataError(self, error):
print "dataError:"
printl(error,self,"E")
self.streamListe.append(("Read error !",""))
self.streamMenuList.setList(map(streamitStreamListEntry, self.streamListe))
def got_link(self, stream_url):
print "got_link:"
if stream_url == None:
message = self.session.open(MessageBox, _("Stream not found, try another Stream Hoster."), MessageBox.TYPE_INFO, timeout=3)
else:
title = self.filmName + self['liste'].getCurrent()[0][2]
if config.mediaportal.useHttpDump.value:
movieinfo = [stream_url,self.filmName,""]
self.session.open(PlayHttpMovie, movieinfo, title)
else:
self.session.open(SimplePlayer, [(title, stream_url, self.imageUrl)], cover=True, showPlaylist=False, ltype='streamit')
def keyTrailer(self):
if self.trailerId:
self.session.open(
YoutubePlayer,
[(self.filmName, '', self.trailerId, self.imageUrl)],
playAll = False,
showPlaylist=False,
showCover=True
)
def keyTMDbInfo(self):
if TMDbPresent:
self.session.open(TMDbMain, self.filmName)
elif IMDbPresent:
self.session.open(IMDB, self.filmName)
def keyOK(self):
if self.keyLocked:
return
streamLink = self['liste'].getCurrent()[0][1]
self.tw_agent_hlp.getRedirectedUrl(self.keyOK2, self.dataError, streamLink)
#get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyOK2(self, streamLink):
saveads = re.search('.*?saveads.org', streamLink, re.S)
if saveads:
id = re.search('url=(.*?)%3D', streamLink, re.S)
url = "http://streamit.ws/go.php?url=" + id.group(1)
self.tw_agent_hlp.getRedirectedUrl(self.keyOK3, self.dataError, url)
else:
get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyOK3(self, streamLink):
get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyTxtPageUp(self):
self['handlung'].pageUp()
def keyTxtPageDown(self):
self['handlung'].pageDown()
def keyCancel(self):
self.close()
示例13: IStreamStreams
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
#.........这里部分代码省略.........
self.tw_agent_hlp = TwAgentHelper()
self.streamListe = []
self.streamMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self.streamMenuList.l.setFont(0, gFont('mediaportal', 24))
self.streamMenuList.l.setItemHeight(25)
self['liste'] = self.streamMenuList
self.keyLocked = True
self.onLayoutFinish.append(self.loadPage)
def loadPage(self):
print "loadPage:"
streamUrl = self.filmUrl
#print "FilmUrl: %s" % self.filmUrl
#print "FilmName: %s" % self.filmName
#getPage(streamUrl, headers={'Content-Type':'application/x-www-form-urlencoded'}).addCallback(self.parseData).addErrback(self.dataError)
self.tw_agent_hlp.getWebPage(self.parseData, self.dataError, streamUrl, False)
def parseData(self, data):
print "parseData:"
streams = re.findall('a class="hoster-button.*?href="(.*?)".*?title=".*?\[(.*?)\](.*?)"', data)
mdesc = re.search('class="desc">(.*?)<br />',data, re.S)
if mdesc:
print "Descr. found"
desc = mdesc.group(1).strip()
else:
desc = "Keine weiteren Info's !"
self.streamListe = []
if streams:
print "Streams found"
for (isUrl,isStream,streamPart) in streams:
if re.match('.*?(putlocker|sockshare|flash strea|streamclou|xvidstage|filenuke|movreel|nowvideo|xvidstream|uploadc|vreer|MonsterUploads|Novamov|Videoweed|Divxstage|Ginbig|Flashstrea|Movshare|yesload|faststream|Vidstream|PrimeShare|flashx|Divxmov|Putme|Zooupload|Click.*?Play|BitShare)', isStream, re.S|re.I):
#print isUrl
#print isStream,streamPart
self.streamListe.append((isStream,isUrl,streamPart))
else:
print "No supported hoster:"
print isStream
print isUrl
else:
print "No Streams found"
self.streamListe.append(("No streams found !","",""))
self.streamMenuList.setList(map(IStreamStreamListEntry, self.streamListe))
self['handlung'].setText(decodeHtml(desc))
self.keyLocked = False
print "imageUrl: ",self.imageUrl
if self.imageUrl:
downloadPage(self.imageUrl, "/tmp/Icon.jpg").addCallback(self.ShowCover)
def ShowCover(self, picData):
print "ShowCover:"
if fileExists("/tmp/Icon.jpg"):
self['coverArt'].instance.setPixmap(gPixmapPtr())
self.scale = AVSwitch().getFramebufferScale()
self.picload = ePicLoad()
size = self['coverArt'].instance.size()
self.picload.setPara((size.width(), size.height(), self.scale[0], self.scale[1], False, 1, "#FF000000"))
if self.picload.startDecode("/tmp/Icon.jpg", 0, 0, False) == 0:
ptr = self.picload.getData()
if ptr != None:
self['coverArt'].instance.setPixmap(ptr)
self['coverArt'].show()
del self.picload
def dataError(self, error):
print "dataError:"
print error
self.streamListe.append(("Read error !",""))
self.streamMenuList.setList(map(IStreamStreamListEntry, self.streamListe))
def got_link(self, stream_url):
print "got_link:"
if stream_url == None:
message = self.session.open(MessageBox, _("Stream not found, try another Stream Hoster."), MessageBox.TYPE_INFO, timeout=3)
else:
title = self.filmName + self['liste'].getCurrent()[0][2]
if config.mediaportal.useHttpDump.value:
movieinfo = [stream_url,self.filmName,""]
self.session.open(PlayHttpMovie, movieinfo, title)
else:
self.session.open(iStreamPlayer, [(title, stream_url, self.imageUrl)], showCover=True)
def keyOK(self):
if self.keyLocked:
return
streamLink = self['liste'].getCurrent()[0][1]
self.tw_agent_hlp.getRedirectedUrl(self.keyOK2, self.dataError, streamLink)
def keyOK2(self, streamLink):
get_stream_link(self.session).check_link(streamLink, self.got_link)
def keyTxtPageUp(self):
self['handlung'].pageUp()
def keyTxtPageDown(self):
self['handlung'].pageDown()
def keyCancel(self):
self.close()
示例14: wsoStreams
# 需要导入模块: from Plugins.Extensions.MediaPortal.resources.twagenthelper import TwAgentHelper [as 别名]
# 或者: from Plugins.Extensions.MediaPortal.resources.twagenthelper.TwAgentHelper import getRedirectedUrl [as 别名]
class wsoStreams(MPScreen):
def __init__(self, session, title, episode, url):
self.serieUrl = url
self.Title = title
self.episode = episode
self.plugin_path = mp_globals.pluginPath
self.skin_path = mp_globals.pluginPath + mp_globals.skinsPath
path = "%s/%s/defaultListScreen.xml" % (self.skin_path, config.mediaportal.skin.value)
if not fileExists(path):
path = self.skin_path + mp_globals.skinFallback + "/defaultListScreen.xml"
with open(path, "r") as f:
self.skin = f.read()
f.close()
MPScreen.__init__(self, session)
self["actions"] = ActionMap(["MP_Actions"], {
"0" : self.closeAll,
"ok" : self.keyOK,
"cancel": self.keyCancel
}, -1)
self['title'] = Label("watchseries-online")
self['leftContentTitle'] = Label(_("Stream Selection"))
self['ContentTitle'] = Label(_("Stream Selection"))
self['name'] = Label(self.Title)
self.streamList = []
self.ml = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent)
self['liste'] = self.ml
self.keyLocked = True
self.onLayoutFinish.append(self.loadPage)
self.tw_agent_hlp = TwAgentHelper()
def loadPage(self):
getPage(self.serieUrl).addCallback(self.parseData).addErrback(self.dataError)
def parseData(self, data):
streams = re.findall('<a\starget="_blank"\srel="nofollow"\shref="(.*?)">(.*?)</a>', data, re.S)
if streams:
for (url, hoster) in streams:
if isSupportedHoster(hoster, True):
self.streamList.append((hoster, url))
if len(self.streamList) == 0:
self.streamList.append((_('No supported streams found!'), None))
self.ml.setList(map(self._defaultlisthoster, self.streamList))
self.keyLocked = False
def keyOK(self):
current = self['liste'].getCurrent()
if self.keyLocked or current == None:
return
url = current[0][1]
if url:
self.tw_agent_hlp.getRedirectedUrl(url).addCallback(self.getStream).addErrback(self.dataError)
def getStream(self, url):
get_stream_link(self.session).check_link(url, self.playfile)
def playfile(self, stream_url):
if not re.search('\S[0-9][0-9]E[0-9][0-9]', self.Title, re.I):
self.streamname = self.Title + " - " + self.episode
else:
self.streamname = self.Title
if not fileExists(config.mediaportal.watchlistpath.value+"mp_wso_watched"):
open(config.mediaportal.watchlistpath.value+"mp_wso_watched","w").close()
self.update_list = []
empty = os.path.getsize(config.mediaportal.watchlistpath.value+"mp_wso_watched")
if not empty == 0:
self.updates_read = open(config.mediaportal.watchlistpath.value+"mp_wso_watched" , "r")
for lines in sorted(self.updates_read.readlines()):
line = re.findall('"(.*?)"', lines)
if line:
self.update_list.append("%s" % (line[0]))
self.updates_read.close()
updates_read2 = open(config.mediaportal.watchlistpath.value+"mp_wso_watched" , "a")
check = ("%s" % self.streamname)
if not check in self.update_list:
print "update add: %s" % (self.streamname)
updates_read2.write('"%s"\n' % (self.streamname))
updates_read2.close()
else:
print "dupe %s" % (self.streamname)
else:
updates_read3 = open(config.mediaportal.watchlistpath.value+"mp_wso_watched" , "a")
print "update add: %s" % (self.streamname)
updates_read3.write('"%s"\n' % (self.streamname))
updates_read3.close()
self.session.open(SimplePlayer, [(self.streamname, stream_url)], showPlaylist=False, ltype='watchseriesonline')