def showXXX(): params = ParameterHandler() oGui = cGui() __createMainMenuEntry(oGui, 'Alle Pornos', 661) #im Moment können keine Clips abgespielt werden da die Cliphoster nicht aufgelöst werden können #__createMainMenuEntry(oGui, 'Clips', 669, sSecurityValue) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('displaySearch') oGuiElement.setTitle('Suche XXX Streams') params.setParam('searchType', '530') oGui.addFolder(oGuiElement, params) __createMainMenuEntry(oGui, 'Amateure', '661&prefixid=Amateure1') __createMainMenuEntry(oGui, 'Anal', '661&prefixid=Anal') __createMainMenuEntry(oGui, 'Asia', '661&prefixid=Asia') __createMainMenuEntry(oGui, 'Black', '661&prefixid=Ebony') __createMainMenuEntry(oGui, 'B*****b', '661&prefixid=B*****b') __createMainMenuEntry(oGui, 'Deutsch', '661&prefixid=Deutsch') __createMainMenuEntry(oGui, 'Fetish', '661&prefixid=Fetish') __createMainMenuEntry(oGui, 'Große Brüste', '661&prefixid=GrosseBrueste') __createMainMenuEntry(oGui, 'Gruppensex', '661&prefixid=Gruppensex') __createMainMenuEntry(oGui, 'Gay', '661&prefixid=Gay') __createMainMenuEntry(oGui, 'Hardcore', '661&prefixid=Hardcore') __createMainMenuEntry(oGui, 'International', '661&prefixid=International') __createMainMenuEntry(oGui, 'Lesben', '661&prefixid=Lesben') __createMainMenuEntry(oGui, 'Masturbation', '661&prefixid=Masturbation') __createMainMenuEntry(oGui, 'Teens', '661&prefixid=Teens') oGui.setEndOfDirectory()
def __getAllSeasons(sUrl): oGui = cGui() oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = '<SELECT name="season".*?>(.*?)</SELECT>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sPattern = '<OPTION value="(\d+)".*?>([^<]+)</OPTION>' aResult = oParser.parse(sHtmlContent,sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showAllEpisodes') sTitle = aEntry[1].strip() oGuiElement.setTitle(sTitle) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', sUrl) oOutputParameterHandler.setParam('season', aEntry[0]) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setView('seasons') oGui.setEndOfDirectory()
def showHosters(): # ParameterHandler erzeugen params = ParameterHandler() # URL Anpassen um die Stream und nicht die Infos zu bekommen entryUrl = params.getValue('entryUrl').replace("-info","-stream") # Seite abrufen sHtmlContent = cRequestHandler(entryUrl).request() # Prüfen ob Episoden gefunden werden pattern = '<a[^>]*episode="([^"]*)"[^>]*href="([^"]*)"[^>]*>' aResult = cParser().parse(sHtmlContent, pattern) # Prüfen ob Einträge vorliegen if not aResult[0]: return # Ermitteln ob es sich um eine Serie handelt isTvshowEntry = params.getValue('isTvshow') # Falls Episoden gefunden worden => Episodenauswahl vorschalten if isTvshowEntry == 'True': showEpisodes(aResult[1], params) else: return getHosters(entryUrl)
def __getHtmlContent(sUrl = None, sSecurityValue = None): oParams = ParameterHandler() # Test if a url is available and set it if sUrl is None and not oParams.exist('sUrl'): logger.error("There is no url we can request.") return False else: if sUrl is None: sUrl = oParams.getValue('sUrl') # Test if a security value is available if sSecurityValue is None: if oParams.exist("securityCookie"): sSecurityValue = oParams.getValue("securityCookie") if not sSecurityValue: sSecurityValue = '' # preferred language sPrefLang = __getPreferredLanguage() # Make the request oRequest = cRequestHandler(sUrl) oRequest.addHeaderEntry('Cookie', sPrefLang+sSecurityValue+'ListDisplayYears=Always;') oRequest.addHeaderEntry('Referer', URL_MAIN) oRequest.addHeaderEntry('Accept', '*/*') oRequest.addHeaderEntry('Host', domain) return oRequest.request()
def showSeries(): oGui = cGui() oParams = ParameterHandler() sUrl = URL_SERIES oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request(); sChar = oParams.getValue('char') if sChar: sChar = sChar.lower() series = json.loads(sHtmlContent) total = len(series) for serie in series: sTitle = serie["series"].encode('utf-8') if sChar: if sChar == '#': if sTitle[0].isalpha():continue elif sTitle[0].lower() != sChar: continue guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({'siteUrl' : URL_SERIES + '/' + str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, oParams, iTotal = total) oGui.setView('tvshows') oGui.setEndOfDirectory()
def __writeLog(sLog, cLogLevel): params = ParameterHandler() if params.exist('site'): site = params.getValue('site') print "\t[xStream] ->%s: %s" %(site,sLog) else: print "\t[xStream] %s" % sLog
def showFrontPage(): oParams = ParameterHandler() sPattern = '<div class="box-container">.*?<a href="(.*?)".*?Staffel (.*?) Episode (.*?)".*?src="(http://seriesever.net/uploads/posters/thumb/.*?)".*?alt="(.*?)"' # request sHtmlContent = __getHtmlContent(URL_MAIN) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for link, season, episode, img, title in aResult[1]: guiElement = cGuiElement('%s: Season %s - Episode %s' % (title, season, episode), SITE_IDENTIFIER, 'showHosters') guiElement.setMediaType('episode') guiElement.setSeason(season) # Special fix for non-int episode numbers (like Attack on Titan 13.5) # Can't even check this on thetvdb.com, because AOT 13.5 for example is Season 0 Episode 1 # May I can use "<airsbefore_episode>" and "<airsbefore_season>" for metadata if representsInt(episode): guiElement.setEpisode(episode) guiElement.setTVShowTitle(title) guiElement.setThumbnail(img) oParams.setParam('sUrl', link) oGui.addFolder(guiElement, oParams, bIsFolder=False) oGui.setView('episodes') oGui.setEndOfDirectory()
def _parseMovieList(url): oGui = cGui() params = ParameterHandler() oRequestHandler = cRequestHandler(url) sHtmlContent = oRequestHandler.request() # parse movie entries pattern = 'class="tabel-topasd".*?<a href="([^"]+)"><img src="([^"]+)" title="([^"]+)".*?<span.*?>([^<>]+)</span>.*?title="([^"]+)"/>' oParser = cParser() aResult = oParser.parse(sHtmlContent, pattern) if not aResult[0]: return total = len(aResult[1]) # Anzahl der Treffer for link, img, title, plot, qual in aResult[1]: titleParts = title.split('(') # Titel von Jahr trennen movieTitle = titleParts[0].strip().decode('iso-8859-1').encode('utf-8') # encoding anpassen wegen Umlauten guiElement = cGuiElement(movieTitle, SITE_IDENTIFIER, 'getHosters') guiElement.setThumbnail(img) #Cover als Thumbnail setzen guiElement.setDescription(plot.decode('iso-8859-1')) # Filmbeschreibung setzen, decode wegen Umlauten if len(titleParts)>1: tag = titleParts[-1].replace(')','') if tag.isdigit() and len(tag)==4: guiElement.setYear(tag) guiElement.setMediaType('movie') if '720p' in qual: # erst mal unwichtig guiElement._sQuality = 720 elif '1080p' in qual: guiElement._sQuality = 1080 params.setParam('siteUrl',link) oGui.addFolder(guiElement, params, bIsFolder = False, iTotal = total) oGui.setView('movies') #diese Liste unterliegt den automatisch ViewSettings für Filmlisten oGui.setEndOfDirectory()
def showSearchEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue("sUrl") sHtmlContent = cRequestHandler(entryUrl).request() pattern = ( 'class="short">.*?href="([^"]+)"[^>]class="title">([^<(]+)[^>]([^")]+).*?<img[^>]src="([^"]+)".*?>([^<]+)</p>' ) aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0]: if not sGui: oGui.showInfo("xStream", "Es wurde kein Eintrag gefunden") return total = len(aResult[1]) util = cUtil() for sEntryUrl, sName, sYear, sThumbnail, sDescription in aResult[1]: oGuiElement = cGuiElement(util.unescape(sName.decode("utf-8")).encode("utf-8"), SITE_IDENTIFIER, "showHosters") oGuiElement.setThumbnail(URL_MAIN + sThumbnail) oGuiElement.setDescription(util.unescape(sDescription.decode("utf-8")).encode("utf-8")) oGuiElement.setYear(sYear) oGuiElement.setMediaType("movie") params.setParam("entryUrl", sEntryUrl) oGui.addFolder(oGuiElement, params, False, total) return
def showGenres(): oGui = cGui() params = ParameterHandler() for key in sorted(URL_GENRES_LIST): params.setParam("sUrl", (URL_MAIN + URL_GENRES_LIST[key])) oGui.addFolder(cGuiElement(key, SITE_IDENTIFIER, "showEntries"), params) oGui.setEndOfDirectory()
def showHostersSeries(): oInputParameterHandler = ParameterHandler() if (oInputParameterHandler.exist('sUrl') and oInputParameterHandler.exist('sMovieTitle')): sUrl = oInputParameterHandler.getValue('sUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sHtmlContent = cRequestHandler(sUrl).request() sPattern = '<tr id="tablemoviesindex2".*?<a href="([^"]+)".*? width="16">([^<]+)<' aResult = cParser().parse(sHtmlContent.replace('\\',''), sPattern) if (aResult[0] == True): hosters = [] previousName = '' iMatches = 2 for aEntry in aResult[1]: sHoster = aEntry[1].strip() hoster = {} hoster['name'] = sHoster hoster['link'] = URL_MAIN + aEntry[0] if hoster['name'] == previousName: hoster['displayedName'] = hoster['name'] + ' ('+str(iMatches)+')' iMatches += 1 else: previousName = hoster['name'] iMatches = 2 hosters.append(hoster) hosters.append('showHoster') return hosters
def getHosters(): oParams = ParameterHandler() sChannelUrl = oParams.getValue('channelUrl') sChannelName = oParams.getValue('channelName') logger.info('get stream url for URL: ' + sChannelUrl) oRequestHandler = cRequestHandler(sChannelUrl) oRequestHandler.addHeaderEntry('Referer', URL_MAIN) sHtmlContent = oRequestHandler.request(); hosters = [] sPattern = "'file': '(.*?)'," oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sUrl = str(aResult[1])[2:-2] logger.info('load channel ' + sChannelName + ' with url ' + sUrl) hoster = {} hoster['link'] = sUrl hoster['name'] = 'streamcloud' # dummy hosters.append(hoster) hosters.append('getHosterUrl') return hosters
def showHosters(): params = ParameterHandler() sHtmlContent = cRequestHandler(params.getValue('entryUrl')).request() aResult = cParser().parse(sHtmlContent, "var[ ]subcats[ ]=[ ](.*?);") if not aResult[0]: return [] hosters = [] data = json.loads(aResult[1][0]) sJsonID = params.getValue('sJsonID') if not sJsonID: sJsonID = data.keys()[0] partCount = 1 # fallback for series (because they get no MultiParts) if '1' in data[sJsonID]: partCount = int(data[sJsonID]['1']) for jHoster in data[sJsonID]['links']: for jHosterEntry in data[sJsonID]['links'][jHoster]: if jHosterEntry[5] != 'stream': continue hoster = {} if partCount > 1: hoster['displayedName'] = jHoster + ' - Part ' + jHosterEntry[0] hoster['link'] = jHosterEntry[3] hoster['name'] = jHoster hosters.append(hoster) if len(hosters) > 0: hosters.append('getHosterUrl') return hosters
def _getInfoAndResolve(self, siteResult): import urlresolver oGui = cGui() params = ParameterHandler() # get data data = {} mediaUrl = params.getValue('sMediaUrl') fileName = params.getValue('MovieTitle') if not fileName: fileName = params.getValue('Title') if not fileName: #only temporary fileName = params.getValue('sMovieTitle') if not fileName: fileName = params.getValue('title') data['title'] = fileName data['season'] = params.getValue('season') data['episode'] = params.getValue('episode') data['showTitle'] = params.getValue('TVShowTitle') data['thumb'] = params.getValue('thumb') # resolve if siteResult: mediaUrl = siteResult['streamUrl'] logger.info('resolve: ' + mediaUrl) if siteResult['resolved']: link = mediaUrl else: link = urlresolver.resolve(mediaUrl) elif mediaUrl: logger.info('resolve: ' + mediaUrl) link = urlresolver.resolve(mediaUrl) else: oGui.showError('xStream', 'kein Hosterlink übergeben', 5) return False #resolver response if hasattr(link, 'msg'): msg = link.msg else: msg = False if link != False and not msg: data['link'] = link return data # error during resolving if not msg: msg = 'Stream nicht mehr verfügbar oder Link fehlerhaft' oGui.showError('xStream',str(msg),7) if hasattr(link, 'code'): logger.info(str(msg) +' UnresolveableCode: '+ str(link.code)) else: logger.info(str(msg) +' UnresolveableCode: - ') ''' UnresolveableCode 0: Unknown Error 1: The url was resolved, but the file has been permanantly removed 2: The file is temporarily unavailable for example due to planned site maintenance 3. There was an error contacting the site for example a connection attempt timed out ''' return False
def showSeries(): oGui = cGui() oParams = ParameterHandler() sChar = oParams.getValue('char') if sChar: sChar = sChar.lower() series = _getJsonContent("series") total = len(series) for serie in series: sTitle = serie["series"].encode('utf-8') if sChar: if sChar == '#': if sTitle[0].isalpha(): continue elif sTitle[0].lower() != sChar: continue if oParams.getValue('specific') == 'Season': guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'randomSeason') else: guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) # Load series description by iteration through the REST-Api (slow) #sDesc = _getJsonContent("series/%d/1" % int(serie['id'])) #guiElement.setDescription(sDesc['series']['description'].encode('utf-8')) #sStart = str(sDesc['series']['start']) #if sStart != 'None': # guiElement.setYear(int(sDesc['series']['start'])) oParams.addParams({'seriesID' : str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, oParams, iTotal = total) oGui.setView('tvshows') oGui.setEndOfDirectory()
def showHosters(): params = ParameterHandler() imdbID = params.getValue('itemID') lang = params.getValue('lang') if not imdbID or not lang: return hosters = [] for sLang in re.compile('(\w+)-').findall(lang): oResponse = _getJSonResponse(URL_LINKS, {'ID':imdbID,'lang':sLang} ) if 'links' not in oResponse or len(oResponse['links']) == 0: return for aEntry in oResponse['links']: hoster = dict() if oResponse['links'][aEntry][0].upper() in QUALITY_ENUM: hoster['quality'] = QUALITY_ENUM[oResponse['links'][aEntry][0]] hoster['link'] = URL_OUT % oResponse['links'][aEntry][1] hoster['name'] = aEntry hoster['displayedName'] = '%s (%s) - Quality: %s' % (aEntry, sLang, oResponse['links'][aEntry][0]) hosters.append(hoster) if hosters: hosters = sorted(hosters, key=lambda k: k['name']) #sort by hostername hosters.append('play') return hosters
def showSeasons(): logger.info('load showSeasons') oParams = ParameterHandler() sTitle = oParams.getValue('Title') sPattern = '<a href="#season-(.*?)" data-parent=".*?>(.*?)</a>' # request sHtmlContent = __getHtmlContent() # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if aResult[0]: for sId, seasonNum in aResult[1]: guiElement = cGuiElement('%s - Staffel %s' % (sTitle, seasonNum), SITE_IDENTIFIER, 'showEpisodes') guiElement.setMediaType('season') guiElement.setSeason(seasonNum) guiElement.setTVShowTitle(sTitle) oParams.setParam('Season', seasonNum) oGui.addFolder(guiElement, oParams) oGui.setView('seasons') oGui.setEndOfDirectory()
def _cinema(oGui): sPattern = '<div class="Opt leftOpt Headlne"><a title="(.*?)" href="(.*?)">.*?src="(.*?)".*?class="Descriptor">(.*?)</div.*?/lng/([0-9]+).png".*?IMDb:</b> (.*?) /' oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sHtmlContent = __getHtmlContent(URL_CINEMA_PAGE, sSecurityValue) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) # iterate result and create GuiElements if not aResult[0]: return total = len(aResult[1]) for aEntry in aResult[1]: sMovieTitle = aEntry[0] lang = __createLanguage(aEntry[4]) rating = aEntry[5] oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('parseMovieEntrySite') oGuiElement.setLanguage(lang) oGuiElement.setTitle(sMovieTitle) oGuiElement.setDescription(aEntry[3]) oGuiElement.setMediaType('movie') oGuiElement.setThumbnail(URL_MAIN + str(aEntry[2])) oGuiElement.addItemValue('rating', rating) oParams.setParam('sUrl', URL_MAIN + str(aEntry[1])) oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total)
def showEpisodes(): logger.info('load showEpisodes') oParams = ParameterHandler() sTitle = oParams.getValue('Title') sSeason = oParams.getValue('Season') sPattern = 'class="list-group-item".*?<span itemprop="name">Staffel ' + sSeason + ' Episode(?:[\s]*)(.*?)</span>.*?<a class="episode-name" href="(.*?)" title="(.*?)"' # request sHtmlContent = __getHtmlContent() # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for eNr, link, title in aResult[1]: guiElement = cGuiElement('Episode %s - %s' % (eNr, title), SITE_IDENTIFIER, 'showHosters') guiElement.setMediaType('episode') guiElement.setSeason(sSeason) # Special fix for non-int episode numbers (like Attack on Titan 13.5) # Can't even check this on thetvdb.com, because AOT 13.5 for example is Season 0 Episode 1 # May I can use "<airsbefore_episode>" and "<airsbefore_season>" for metadata if representsInt(eNr): guiElement.setEpisode(eNr) guiElement.setTVShowTitle(sTitle) oParams.setParam('sUrl', link) oGui.addFolder(guiElement, oParams, bIsFolder=False) oGui.setView('episodes') oGui.setEndOfDirectory()
def showHosters(): params= ParameterHandler() oRequestHandler = cRequestHandler(params.getValue('entryUrl')) sHtmlContent = oRequestHandler.request() pattern = '<div class="inner" style="display:none;">' pattern += '.*?<a target="_blank" href="([^"]+)">' aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0]: return hosters = [] idx = 0 previousName = '' for sUrl in aResult[1]: hoster = dict() hoster['link'] = sUrl hname = 'Unknown Hoster' try: hname = getHosterName(hoster['link']) except: pass if hname == 'linkcrypt.ws': resolveLinkcrypt(sUrl, hosters) continue if previousName != hname: idx = 1 previousName = hname hname = "Part %d - %s" % (idx, hname) idx += 1 hoster['name'] = previousName hoster['displayedName'] = hname hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def _cinema(oGui): sPattern = '<div class="Opt leftOpt Headlne"><a title="(.*?)" href="(.*?)">.*?src="(.*?)".*?class="Descriptor">(.*?)</div.*?/lng/([0-9]+).png".*?IMDb:</b> (.*?) /' oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sHtmlContent = __getHtmlContent(URL_CINEMA_PAGE, sSecurityValue) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) # iterate result and create GuiElements if (aResult[0] == True): total = len(aResult[1]) for aEntry in aResult[1]: sMovieTitle = aEntry[0] lang = aEntry[4] rating = aEntry[5] oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('parseMovieEntrySite') oGuiElement.setTitle(__createTitleWithLanguage(lang, sMovieTitle)) oGuiElement.setDescription(aEntry[3]) oGuiElement.setMediaType('movie') oGuiElement.setThumbnail(aEntry[2]) oGuiElement.addItemValue('rating',rating) #if META: # oMetaget = metahandlers.MetaData() # meta = oMetaget.get_meta('movie', sMovieTitle) # oGuiElement.setItemValues(meta) # oGuiElement.setThumbnail(meta['cover_url']) # oGuiElement.setFanart(meta['backdrop_url']) # oParams.setParam('imdbID', meta['imdb_id']) oParams.setParam('sUrl', URL_MAIN + str(aEntry[1])) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = total)
def showHosters(): #oGui = cGui() oParams= ParameterHandler() sTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() #if not META: # __createInfo(oGui, sHtmlContent, sTitle) sPattern = '<h3>Hoster dieser Episode(.*?)</ul>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): hosters = [] sHtmlContent = aResult[1][0] sPattern = 'href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: hoster = dict() hoster['link'] = URL_MAIN + '/' + str(aEntry[0]) hoster['name'] = str(aEntry[2]).split(' - Teil')[0] hoster['displayedName'] = str(aEntry[2]) hosters.append(hoster) hosters.append('getHosterUrl') return hosters
def download(self, siteResult = False): from resources.lib.download import cDownload import urlresolver #oGui = cGui() params = ParameterHandler() sMediaUrl = params.getValue('sMediaUrl') sFileName = params.getValue('sFileName') sFileName = params.getValue('sMovieTitle') if siteResult: sMediaUrl = siteResult['streamUrl'] if siteResult['resolved']: sLink = sMediaUrl else: sLink = urlresolver.resolve(sMediaUrl) else: sLink = urlresolver.resolve(sMediaUrl) logger.info('call download: ' + sMediaUrl) logger.info('file link: ' + str(sLink)) if self.dialog: self.dialog.close() if (sLink != False): oDownload = cDownload() oDownload.download(sLink, 'Stream') else: #cGui().showError('Download', 'File deleted or Link could not be resolved', 5); return False return True
def __writeLog(sLog, cLogLevel): params = ParameterHandler() if params.exist('site'): site = params.getValue('site') print "\t[PLUGIN] xStream->" + site + ": " + str(sLog) else: print "\t[PLUGIN] xStream: " + str(sLog)
def showSeries(sUrl=False): logger.info('load showSeries') oParams = ParameterHandler() if not sUrl: sUrl = oParams.getValue('sUrl') sPagePattern = '<a href="' + sUrl + '(\d+).html">' # request sHtmlContent = __getHtmlContent(sUrl) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPagePattern) pages = 1 if aResult[0]: if representsInt(aResult[1][-1]): pages = aResult[1][-1] oGui = cGui() # because sometimes 2 pages have the same content dupeCheck = [] for x in range(1, int(pages) + 1): dupeCheck = showSeriesPage(oGui, sUrl, x, dupeCheck) oGui.setView('tvshows') oGui.setEndOfDirectory()
def __getMovies(oGui, sHtmlContent): oParams = ParameterHandler() sBlockPattern = '<div class="moviefilm">.*?href="(.*?)"(.*?)src="(.*?)".*?alt="(.*?)"' # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sBlockPattern) unescape = cUtil().unescape if aResult[0]: for link, span, img, title in aResult[1]: title = unescape(title.decode('utf-8')).encode('utf-8') # TODO: Looking for span isn't the best way, but the only difference I found if "span" not in span: if __isSeriesEverAvaiable(): url = __getSELink(link) if url: guiElement = cGuiElement(title, SERIESEVER_IDENTIFIER, 'showMovie') guiElement.setMediaType('movie') guiElement.setThumbnail(img) oParams.addParams({'sUrl': url}) oGui.addFolder(guiElement, oParams) else: guiElement = cGuiElement(title, SITE_IDENTIFIER, 'showHosters') guiElement.setMediaType('movie') guiElement.setThumbnail(img) oParams.addParams({'sUrl': link, 'Title': title}) oGui.addFolder(guiElement, oParams, bIsFolder=False)
def showGenre(): oGui = cGui() oInputParameterHandler = ParameterHandler() if (oInputParameterHandler.exist(PARAM_URL_KEY)): sUrl = oInputParameterHandler.getValue(PARAM_URL_KEY) oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = '<li><a href="([^"]+)" title="Alle[^"]+">([^<]+)<span>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: sUrl = aEntry[0] sUrl = URL_MAIN + sUrl sTitle = aEntry[1].strip() oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showMovies') oGuiElement.setTitle(sTitle) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam(PARAM_URL_KEY, sUrl) oOutputParameterHandler.setParam(PARAM_ROOTURL_KEY, sUrl) oOutputParameterHandler.setParam(PARAM_PAGE_KEY,1) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setEndOfDirectory()
def showHosters(): oInputParameterHandler = ParameterHandler() sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sUrl = oInputParameterHandler.getValue(PARAM_URL_KEY) sHtmlContent = cRequestHandler(sUrl).request() sPattern = 'data-det="([^"]+)"' aResult = cParser().parse(sHtmlContent, sPattern) results = [] if not aResult[0]: return results # can't handle without changes to requestHandler import mechanize, json request = mechanize.Request("http://kkiste.to/xhr/link", aResult[1][0]) request.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') request.add_header("X-Requested-With","XMLHttpRequest") request.add_header('Referer', sUrl) request.add_header('Accept', '*/*') request.add_header('Host', SITE_NAME.lower()) request.add_header('Content-Length',len(aResult[1][0])) request.add_header('Content-Type','text/plain') resp = mechanize.urlopen(request) sHtmlContent = resp.read() try: items = json.loads(sHtmlContent) except: return results # multipart stream for i, item in enumerate(items) : result = {} result['streamUrl'] = 'http://www.ecostream.tv/stream/'+item result['resolved'] = False result['title'] = sMovieTitle + ' part ' +str(i) results.append(result) return results
def _search(oGui, sSearchString): searchUrl = URL_MAIN + 'livesearch.php?q=' oRequest = cRequestHandler(searchUrl + sSearchString) content = oRequest.request() searchPattern = "<table.*?<a href='([^']+)'.*?<img src='([^']+)'.*?>([^<>']+)</a>" oParser = cParser() aResult = oParser.parse(content, searchPattern) if not aResult[0]: return ###### parse entries params = ParameterHandler() function = 'getHosters' iTotal = len(aResult[1]) for link, img, title in aResult[1]: sLabel = title.split('(') sTitle = sLabel[0].strip() sNextUrl = link params.setParam('siteUrl',sNextUrl) oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, function) oGuiElement.setThumbnail(img) #oGuiElement.setMediaType('movie') if len(sLabel)>1: year = sLabel[-1].replace(')','') oGuiElement.setYear(year) if 'site=Movies' in link: oGuiElement.setMediaType('movie') oGui.addFolder(oGuiElement, params, bIsFolder = False, iTotal = iTotal) else: continue
def __getHtmlContent(sUrl = None, sSecurityValue=None): params = ParameterHandler() # Test if a url is available and set it if sUrl is None and not params.exist('siteUrl'): logger.info("There is no url we can request.") return False else: if sUrl is None: sUrl = params.getValue('siteUrl') # Test if a security value is available if sSecurityValue is None: if params.exist('securityCookie'): sSecurityValue = params.getValue('securityCookie') else : sSecurityValue = '' # Make the request oRequest = cRequestHandler(sUrl) #oRequest.addHeaderEntry('Cookie', sSecurityValue) #oRequest.addHeaderEntry('Accept', '*/*') #oRequest.addHeaderEntry('Host', 'gstream.to') return oRequest.request()
def showHosters(): params = ParameterHandler() if params.getValue('isTvshow') == 'True': oRequest = cRequestHandler(HOSTER_URL) oRequest.addHeaderEntry("X-Requested-With", "XMLHttpRequest") oRequest.setRequestType(1) oRequest.addParameters('imdbid', params.getValue('imdbid')) oRequest.addParameters('language', params.getValue('language')) oRequest.addParameters('season', params.getValue('Season')) oRequest.addParameters('episode', params.getValue('Episode')) sHtmlContent = oRequest.request() else: sUrl = params.getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() if not sHtmlContent: return [] pattern = '<a[^>]*href="([^"]+)"[^>]*><img[^>]*class="([s|h]d+)linkbutton"' isMatch, aResult = cParser.parse(sHtmlContent, pattern) hosters = [] if not isMatch: return hosters for sUrl, sQuali in aResult: hoster = {} if not 'nurhdfilm' in sUrl.lower(): hoster['link'] = sUrl hoster['name'] = cParser.urlparse(sUrl) hoster['displayedName'] = '%s %s' % (hoster['name'], sQuali.upper()) hoster['quality'] = QUALITY_ENUM[sQuali.upper()] hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def showGenre(): oGui = cGui() params = ParameterHandler() entryUrl = params.getValue('sUrl') valueType = params.getValue('valueType') sHtmlContent = cRequestHandler(entryUrl).request() pattern = 'href="(?:\.\.\/)*(%s[^"]+)">([^<]+)<\/a><\/li>' % valueType isMatch, aResult = cParser.parse(sHtmlContent, pattern) if not isMatch: return for sID, sName in aResult: params.setParam('sUrl', entryUrl + sID) oGui.addFolder(cGuiElement(sName, SITE_IDENTIFIER, 'showEntries'), params) oGui.setEndOfDirectory()
def showFeaturedSeries(): params = ParameterHandler() if (params.exist('sUrl')): sUrl = params.getValue('sUrl') oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = '<div id="maincontenttvshow">(.*?)<BR><BR>' aResult = cParser().parse(sHtmlContent, sPattern) if aResult[0] == True: sPattern = '<div style="float:left"><a href="([^"]+)"><img src="([^"]+)" border=0.*?title="([^"]+)"></a>.*?<img src="/img/(.*?).png"' sHtmlContent = aResult[1][0] aResult = cParser().parse(sHtmlContent, sPattern) if aResult[0] == True: oGui = cGui() for aEntry in aResult[1]: newUrl = str(aEntry[0]).strip() if not (newUrl.startswith('http')): newUrl = URL_MAIN + '/' + newUrl sThumbnail = aEntry[1] sMovieTitle = aEntry[2].strip().replace('\t', '') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showAllSeasons') oGuiElement.setTitle(sMovieTitle) oGuiElement.setThumbnail( sThumbnail.replace('https', 'http')) oGuiElement.setLanguage(__getLanguage(aEntry[3])) oGuiElement.setMediaType('tvshow') oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', newUrl) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setView('tvshows') oGui.setEndOfDirectory()
def showEpisodes(): oGui = cGui() params = ParameterHandler() sTVShowTitle = params.getValue('sName') entryUrl = params.getValue('entryUrl') sSeasonNr = params.getValue('sSeasonNr') sThumbnail = params.getValue('sThumbnail') sHtmlContent = cRequestHandler(entryUrl).request() pattern = '<span[^>]*class="se-t[^"]*">%s</span>.*?<ul[^>]*class="episodios"[^>]*>(.*?)</ul>' % sSeasonNr isMatch, sContainer = cParser.parseSingleResult(sHtmlContent, pattern) if not isMatch: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return pattern = '<a[^>]*href="([^"]+)"[^>]*>([^<]+)' isMatch, aResult = cParser.parse(sContainer, pattern) if not isMatch: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(aResult) for sUrl, sEpisodeNr in aResult: if sUrl.startswith('//'): sUrl = 'https:' + sUrl oGuiElement = cGuiElement(sEpisodeNr, SITE_IDENTIFIER, 'showHosters') oGuiElement.setTVShowTitle(sTVShowTitle) oGuiElement.setSeason(sSeasonNr) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sThumbnail) oGuiElement.setMediaType('episode') params.setParam('entryUrl', sUrl.strip()) oGui.addFolder(oGuiElement, params, False, total) oGui.setView('episodes') oGui.setEndOfDirectory()
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') oRequestHandler = cRequestHandler(entryUrl, ignoreErrors=(sGui is not False)) oRequestHandler.addHeaderEntry('Referer', entryUrl) sHtmlContent = oRequestHandler.request() parser = cParser() pattern = '<li[^>]*>\s*' # container start pattern += "<a[^>]*href='[^>]*-(\d+).[^>]*'[^>]*>.*?" # entryId pattern += "<img[^>]*src='([^']*)'[^>]*>.*?</a>.*?" # thumbnail pattern += '<a[^>]*title="([^"]*)"[^>]*>([^<]*)</a>.*?' # desc, title pattern += '<p>(\d+)</p>.*?' # year pattern += '</li[^>]*>' # container end isMatch, aResult = parser.parse(sHtmlContent, pattern) if not isMatch: if not sGui: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(aResult) for sEntryId, sThumbnail, sDesc, sName, sYear in aResult: if sDesc.startswith(sName): sDesc = sDesc[len(sName) + 3:].strip() oGuiElement = cGuiElement(sName, SITE_IDENTIFIER, 'showHosters') oGuiElement.setThumbnail(sThumbnail) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) params.setParam('sUrl', URL_Hoster % sEntryId) oGui.addFolder(oGuiElement, params, False, total) if not sGui: isMatchNextPage, sNextUrl = parser.parseSingleResult(sHtmlContent, '</strong>.*?<a[^>]*href="([^"]+)"[^>]*>\d+') if isMatchNextPage: params.setParam('sUrl', URL_MAIN + cUtil.unescape(sNextUrl)) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) oGui.setEndOfDirectory()
def showValueList(): oGui = cGui() params = ParameterHandler() entryUrl = params.getValue('sUrl') valueType = params.getValue('valueType') sHtmlContent = cRequestHandler(entryUrl).request() pattern = '<input[^>]*name="%s[[]]"[^>]*value="(.*?)"[^>]*>(.*?)</' % valueType aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0]: return for sID, sName in aResult[1]: params.setParam('sUrl',entryUrl + '&' + valueType +'[]=' + sID) oGui.addFolder(cGuiElement(sName.strip(), SITE_IDENTIFIER, 'showEntries'), params) oGui.setEndOfDirectory()
def __displayItems(oGui, sHtmlContent): # Test if a cookie was set, else define the default empty one oParams = ParameterHandler() # The pattern to filter every item of the list sPattern = '<td class="Icon"><img width="16" height="11" src="/gr/sys/lng/(\d+).png" alt="language"></td>' + \ '.*?title="([^\"]+)".*?<td class="Title">.*?<a href="([^\"]+)" onclick="return false;">([^<]+)</a> <span class="Year">([0-9]+)</span>' # Parse to get all items of the list oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if not aResult[0]: logger.error("Could not find an item") return # Go throught all items and create a gui element for them. total = len(aResult[1]) for aEntry in aResult[1]: sTitle = cUtil().unescape(aEntry[3]) # split title and subtitle language sTitle, subLang = __checkSubLanguage(sTitle) # get audio language sLang = __createLanguage(aEntry[0]) sUrl = URL_MAIN + aEntry[2] mediaType = '' if aEntry[1] == 'movie' or aEntry[1] == 'cinema': mediaType = 'movie' elif aEntry[1] == 'series': mediaType = 'series' else: mediaType = 'documentation' oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'parseMovieEntrySite') oGuiElement.setLanguage(sLang) oGuiElement.setSubLanguage(subLang) oGuiElement.setYear(aEntry[4]) oParams.setParam('sUrl', sUrl) oParams.setParam('mediaType', mediaType) if mediaType == 'series': oGuiElement.setMediaType('tvshow') oGui.addFolder(oGuiElement, oParams, iTotal=total) elif mediaType == 'movie': oGuiElement.setMediaType('movie') oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total) else: oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total)
def showGenre(): oGui = cGui() params = ParameterHandler() oRequestHandler = cRequestHandler(params.getValue('sUrl')) sHtmlContent = oRequestHandler.request() # Get the URL pattern = '<a[^>]*?class="CatInf"[^>]*?href="(.*?)"[^>]*?>.*?' # Get the entry count pattern += '<div[^>]*?class="CatNumInf"[^>]*?>(\d+)</div>.*?' # Get the genre name pattern += '<div[^>]*?class="CatNameInf"[^>]*?>([^<>]+)</div>' aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0]: return for sUrl, sNum, sName in aResult[1]: if not sUrl or not sNum or not sName: return oGuiElement = cGuiElement("%s (%d)" %(sName, int(sNum)), SITE_IDENTIFIER, 'showEntries') params.setParam('sUrl', sUrl) params.setParam('mediaTypePageId', 1) oGui.addFolder(oGuiElement, params) oGui.setEndOfDirectory()
def showGenre(): oGui = cGui() params = ParameterHandler() oRequestHandler = cRequestHandler(params.getValue('sUrl')) sHtmlContent = oRequestHandler.request() pattern = '<a[^>]*?class="CatInf"[^>]*?href="([^"]+).*?' # Link pattern += '<div[^>]*?class="CatNumInf">(\d+).*?' # count pattern += '<div[^>]*?class="CatNameInf">([^<]+)' # Name isMatch, aResult = cParser.parse(sHtmlContent, pattern) if not isMatch: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return for sUrl, sCount, sName in aResult: params.setParam('sUrl', sUrl) params.setParam('PageId', 1) oGui.addFolder( cGuiElement("%s (%d)" % (sName, int(sCount)), SITE_IDENTIFIER, 'showEntries'), params) oGui.setEndOfDirectory()
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') oRequest = cRequestHandler(entryUrl) if 'serien/' in entryUrl: contentType = 'episodes' mediaType = 'episode' else: contentType = 'movies' mediaType = 'movie' sHtmlContent = oRequest.request() # Grab the link and title pattern = '<a[^>]*href="([^"]*)"[^>]*title="([^"]*)"[^>]*>[^<]*' # Grab the thumbnail pattern += '<img[^>]*src=["\']([^"\']*)["\'][^>]*class="cover-opacity"[^>]*>' aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0]: return for sUrl, sName, sThumbnail in aResult[1]: oGuiElement = cGuiElement(sName, SITE_IDENTIFIER, 'showHosters') oGuiElement.setMediaType(mediaType) if mediaType == 'episode': res = re.search('S(\d{2})E(\d{2})', sName) if res: oGuiElement.setEpisode(res.group(1)) oGuiElement.setSeason(res.group(2)) oGuiElement.setThumbnail(__checkUrl(sThumbnail)) params.setParam('entryUrl', __checkUrl(sUrl)) oGui.addFolder(oGuiElement, params, bIsFolder=False) #check next page pattern = '<a[^>]*class="[^"]*pageing[^"]*"[^>]*' pattern += 'href=["\']([^"\']*)["\'][^>]*>[ ]*vorw' aResult = cParser().parse(sHtmlContent, pattern) if aResult[0] and aResult[1][0]: params.setParam('sUrl', aResult[1][0]) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) if not sGui: oGui.setView(contentType) oGui.setEndOfDirectory()
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() pattern = '<iframe[^>]src="([^"]+)' isMatch, aResult = cParser().parse(sHtmlContent, pattern) hosters = [] if isMatch: for sUrl in aResult: if 'vio.to' in sUrl: oRequest = cRequestHandler('http:' + sUrl) oRequest.addHeaderEntry('Referer', sUrl) sHtmlContent = oRequest.request() pattern = "url:[^>]'([^']+)" isMatch, aResult = cParser().parse(sHtmlContent, pattern) for sUrl in aResult: hoster = {'link': sUrl, 'name': Qualy(sUrl)} hosters.append(hoster) else: hoster = {'link': sUrl, 'name': cParser().urlparse(sUrl)} hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def _webtv_resolver(url): oParams = ParameterHandler() sHtmlContent = cRequestHandler(url).request() if 'web.tv' in url: aResult = cParser().parse(sHtmlContent, '"sources.*?src.."(.*?)"}]') if 'publicvideohost.org' in url: pattern = '(?:file|source)+?:.?(?:"|' pattern += "')(.*?.flv+)(?:" pattern += '"|' + "')" aResult = cParser().parse(sHtmlContent, pattern) #(?:file|source)+?:.?(?:"|')(.*?.[a-zA-Z0-9]{2,3}+)(?:"|') if 'uploadkadeh.com' in url: aResult = cParser().parse(sHtmlContent, 'player_code.*?video\|([^\|]+)') if 'cloudvideo.tv' in url: aResult = cParser().parse(sHtmlContent, 'source..*?"(.+?)"') for sUrl in aResult[1]: if sUrl: return sUrl else: xbmcgui.Dialog().ok("Fehler", 'Error 666: ' + sUrl)
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() pattern = 'class="PartChange"[^>]data-id="([\d]+).*?data-controlid="([\d]+)">.*?alt="([^"]+)' isMatch, aResult = cParser().parse(sHtmlContent, pattern) result, sHoster = cParser().parseSingleResult(sHtmlContent, '".PartChange".*?url:[^>]"([^"]+)') result, token = cParser().parseSingleResult(sHtmlContent, "_token':'([^']+)") hosters = [] if isMatch: for ID, controlid, sName in aResult: request = cRequestHandler(sHoster) request.addParameters('_token', token) request.addParameters('PartID', ID) request.addParameters('ControlID', controlid) request.setRequestType(1) sHtmlContent = request.request() result, link = cParser().parseSingleResult(sHtmlContent, 'src="([^"]+)') hoster = {'link': link, 'name': sName} hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def showEpisodes(): oGui = cGui() params = ParameterHandler() sThumbnail = params.getValue('sThumbnail') sSeason = params.getValue('sSeason') news_id = params.getValue('news_id') sTVShowTitle = params.getValue('sName') oRequest = cRequestHandler(URL_EPISODE) oRequest.addParameters('news_id', news_id) oRequest.addParameters('season', sSeason) oRequest.setRequestType(1) sHtmlContent = oRequest.request() if not sHtmlContent: return data = json.loads(sHtmlContent) if "options" in data: sHtmlContent = data["options"] pattern = '<option[^>]*value="(\d+)"[^>]*>([^<]+(\d+))\s*</option>' isMatch, aResult = cParser.parse(sHtmlContent, pattern) if not isMatch: return total = len(aResult) for seriesId, sName, Episodenr in aResult: oGuiElement = cGuiElement(sName, SITE_IDENTIFIER, 'getHosters') oGuiElement.setTVShowTitle(sTVShowTitle) oGuiElement.setSeason(sSeason) oGuiElement.setEpisode(Episodenr) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setMediaType('episode') params.setParam('seriesId', seriesId) oGui.addFolder(oGuiElement, params, False, total) oGui.setView('episodes') oGui.setEndOfDirectory()
def showLinks(sUrl=False, sName=False): oGui = cGui() params = ParameterHandler() sUrl = sUrl if sUrl else params.getValue('sUrl') sName = sName if sName else params.getValue('sName') oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() pattern = 'var hdfilme6 = (.*?);' aResult = cParser().parse(sHtmlContent, pattern) if not aResult[0] or not aResult[1][0]: return for aEntry in json.loads(aResult[1][0]): if 'file' not in aEntry or 'label' not in aEntry: continue sLabel = sName + ' - ' + aEntry['label'].encode('utf-8') oGuiElement = cGuiElement(sLabel, SITE_IDENTIFIER, 'play') params.setParam('url', aEntry['file']) oGui.addFolder(oGuiElement, params, False) oGui.setEndOfDirectory()
def showHosters(): oParams = ParameterHandler() sTitle = oParams.getValue('Title') seriesId = oParams.getValue('seriesID') season = oParams.getValue('Season') episode = oParams.getValue('EpisodeNr') data = _getJsonContent("series/%s/%s/%s" % (seriesId, season, episode)) hosters = [] for link in data['links']: hoster = dict() hoster['link'] = URL_MAIN + 'watch/' + link['id'] hoster['name'] = link['hoster'] hoster['displayedName'] = link['hoster'] hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def showGenresList(entryUrl=False): oGui = cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') valueType = params.getValue('valueType') sHtmlContent = cRequestHandler(entryUrl).request() pattern = '<li>[^<]*<a[^>]*href="([^"]+%s-online[^"]+)"[^>]*><strong>([^<]+)</strong>' % valueType isMatch, aResult = cParser.parse(sHtmlContent, pattern) if not isMatch: oGui.showInfo('streamon', 'Es wurde kein Eintrag gefunden') return for sUrl, sName in aResult: params.setParam('sUrl', sUrl) oGui.addFolder(cGuiElement(sName, SITE_IDENTIFIER, 'showEntries'), params) oGui.setEndOfDirectory()
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() pattern = 'src="([^"]+)"[^>]*frameborder' aResult = cParser().parse(sHtmlContent, pattern) hosters = [] for hUrl in aResult[1]: if not hUrl.startswith('http'): hUrl = 'https:' + hUrl if 'view.php' in hUrl: oRequest = cRequestHandler(hUrl) oRequest.addHeaderEntry('Referer', hUrl) sHtmlContent = oRequest.request() aResult = cParser().parse(sHtmlContent, "jbdaskgs[^>]=[^>]'([^']+)") cf = cCFScrape.createUrl(sUrl, oRequest) for sUrl in aResult[1]: import base64 sUrl = base64.b64decode(sUrl) isMatch, aResult = cParser.parse(sUrl, '"file":"([^"]+).*?label":"([^"]+)') for sUrl, sQuality in aResult: if 'google' in sUrl: hoster = {'link': sUrl, 'name': sQuality, 'quality': QUALITY_ENUM[sQuality]} else: hoster = {'link': sUrl + cf, 'name': sQuality, 'quality': QUALITY_ENUM[sQuality]} hosters.append(hoster) if 'wp-embed.php' in hUrl: oRequest = cRequestHandler(hUrl) oRequest.addHeaderEntry('Referer', hUrl) sHtmlContent = oRequest.request() aResult = cParser.parse(sHtmlContent, '<iframe[^>]src="([^"]+)') for sUrl in aResult[1]: isMatch, hname = cParser().parseSingleResult(sUrl, '^(?:https?://)?(?:[^@\n]+@)?([^:/\n]+)') hoster = {'link': sUrl, 'name': hname} hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') sHtmlContent = cRequestHandler(entryUrl, ignoreErrors=(sGui is not False)).request() pattern = '<div[^>]*class="movie-preview[^"]*"[^>]*>.*?' # container start pattern += '<img[^>]*src="([^"]*)"[^>]*>.*?' # sThumbnail pattern += '<a[^>]*href="([^"]+)"[^>]*>([^<]+)</a>.*?' # url / name pattern += '<span[^>]*class="movie-release">(\d+)</span>.*?' # year pattern += '<p[^>]*class="story">([^<]+)</p>.*?' # desc pattern += '(?:</div>\s*){4}' # container end isMatch, aResult = cParser.parse(sHtmlContent, pattern) if not isMatch: if not sGui: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(aResult) for sThumbnail, sUrl, sName, sYear, sDesc in aResult: sThumbnail = re.sub('-\d+x\d+\.', '.', sThumbnail) oGuiElement = cGuiElement(sName, SITE_IDENTIFIER, 'showHosters') oGuiElement.setMediaType('movie') oGuiElement.setThumbnail(sThumbnail) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) params.setParam('entryUrl', sUrl) oGui.addFolder(oGuiElement, params, False, total) if not sGui: isMatchNextPage, sNextUrl = cParser.parseSingleResult( sHtmlContent, '<link[^>]*rel="next"[^>]*href="([^"]+)"') if isMatchNextPage: params.setParam('sUrl', sNextUrl) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) oGui.setView('movies') oGui.setEndOfDirectory()
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') isShowAdult = showAdult() sJson = cRequestHandler(entryUrl, ignoreErrors=(sGui is not False)).request() if not sJson: if not sGui: oGui.showError('streamon', 'Fehler beim Laden der Daten.') return aJson = json.loads(sJson) if not 'posts' in aJson or len(aJson['posts']) == 0: if not sGui: oGui.showInfo('streamon', 'Es wurde kein Eintrag gefunden') return total = len(aJson['posts']) for item in aJson["posts"]: try: FSK = ','.join(item['custom_fields']['FSK']) if not isShowAdult and '18' in FSK.lower(): continue oGuiElement = cGuiElement(item['title'].encode('utf-8', 'ignore'), SITE_IDENTIFIER, 'getHosterUrl') oGuiElement.setThumbnail(item['thumbnail'].encode('utf-8', 'ignore')) sFanart = ','.join(item['custom_fields']['featured_img_all']) oGuiElement.setFanart(sFanart.encode('utf-8', 'ignore')) sYahr = ','.join(item['custom_fields']['Jahr']) oGuiElement.setYear(sYahr) oGuiElement.setDescription(item['content']) Youtube = ','.join(item['custom_fields']['Youtube_Delivery_Id']) Streaming = ','.join(item['custom_fields']['Streaming']) params.setParam('Youtube', Youtube) params.setParam('Streaming', Streaming) oGui.addFolder(oGuiElement, params, False, total) except: pass if not sGui: oGui.setEndOfDirectory()
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') sHtmlContent = cRequestHandler(entryUrl).request() pattern = '<table[^>]*class="eBlock"[^>]*>.*?' pattern += '<a[^>]*href="([^"]*)"[^>]*>(.*?)</a>.*?' # url / title pattern += '<img[^>]*src="([^"]*)"[^>]*>.*?' # img pattern += '(?:<fieldset[^>]*>.*?Jahr:</b>\s+(\d+).*?</fieldset>.*?)?' # year (opt) pattern += '</table>' aResult = cParser().parse(sHtmlContent, pattern) if aResult[0] and aResult[1][0]: total = len(aResult[1]) util = cUtil() for sUrl, sName, sThumbnail, sJahr in aResult[1]: oGuiElement = cGuiElement( util.unescape(sName.decode('utf-8')).encode('utf-8'), SITE_IDENTIFIER, 'showHosters') oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setThumbnail( sThumbnail if sThumbnail.startswith("http") else 'http:' + sThumbnail) oGuiElement.setMediaType('movie') oGuiElement.setYear(sJahr) params.setParam( 'entryUrl', sUrl if sUrl.startswith("http") else URL_MAIN + sUrl) oGui.addFolder(oGuiElement, params, False, total) pattern = '<a[^>]*class="swchItem"[^>]*href="([^"]+)"[^>]*><span>»</span>' aResult = cParser().parse(sHtmlContent, pattern) if aResult[0] and aResult[1][0]: params.setParam('sUrl', URL_MAIN + aResult[1][0]) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) if not sGui: oGui.setView('movies') oGui.setEndOfDirectory()
def showEntries(entryUrl=False, sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') oRequestHandler = cRequestHandler(entryUrl, ignoreErrors=(sGui is not False)) oRequestHandler.addHeaderEntry('Referer', entryUrl) sHtmlContent = oRequestHandler.request() parser = cParser() pattern = '<li[^>]*title="(.*?)\((:?\d+)?\).*?(:?\s+-\s+(:?[^"]+))?"[^>]*>.*?' # name / year / desc pattern += "<a[^>]*href='[^>]*-(\d+).[^>]*'[^>]*>.*?" # url pattern += "<img[^>]*src='([^']*)'[^>]*>.*?" # img pattern += "</li>" # title isMatch, aResult = parser.parse(sHtmlContent, pattern) if not isMatch: if not sGui: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(aResult) for sName, sYear, sUglyDesc, sDesc, sUrl, sThumbnail in aResult: oGuiElement = cGuiElement(sName, SITE_IDENTIFIER, 'showHosters') oGuiElement.setThumbnail(sThumbnail) oGuiElement.setDescription(cUtil().unescape( sDesc.decode('utf-8')).encode('utf-8')) oGuiElement.setYear(sYear) params.setParam('sUrl', URL_Hoster % sUrl) oGui.addFolder(oGuiElement, params, False, total) isMatchNextPage, sNextUrl = parser.parseSingleResult( sHtmlContent, '</strong>.*?<a[^>]*href="([^"]+)"[^>]*>\d+') if isMatchNextPage: params.setParam('sUrl', URL_MAIN + cUtil().unescape(sNextUrl)) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) if not sGui: oGui.setEndOfDirectory()
def showEntries(entryUrl = False, sGui = False): oGui = sGui if sGui else cGui() params = ParameterHandler() if not entryUrl: entryUrl = params.getValue('sUrl') sHtmlContent = cRequestHandler(entryUrl).request() parser = cParser() aResult = parser.parse(sHtmlContent, '<h2[^>]*class="maintitle">(.*?)<center') # filter main content if needed if aResult[0]: sHtmlContent = aResult[1][0] pattern = '<div[^>]*class="thumbnail">.*?' # container pattern += '<a[^>]*href="([^"]*)"[^>]*title="([^"]*)"[^>]*>.*?' # linke / title pattern += '<img[^>]*src="([^"]*)"' # image aResult = parser.parse(sHtmlContent, pattern) if not aResult[0]: if not sGui: oGui.showInfo('xStream','Es wurde kein Eintrag gefunden') return util = cUtil() total = len (aResult[1]) for sEntryUrl, sName, sThumbnail in aResult[1]: if "stream" not in sEntryUrl: continue oGuiElement = cGuiElement(util.unescape(sName.decode('utf-8')).encode('utf-8'), SITE_IDENTIFIER, 'showHosters') oGuiElement.setThumbnail(sThumbnail) oGuiElement.setMediaType('movie') params.setParam('entryUrl', sEntryUrl) oGui.addFolder(oGuiElement, params, False, total) pattern = '<a[^>]*class="nextpostslink"[^>]*href="([^"]+)"' aResult = parser.parse(sHtmlContent, pattern) if aResult[0] and aResult[1][0]: params.setParam('sUrl', aResult[1][0]) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) if not sGui: oGui.setView('movies') oGui.setEndOfDirectory() return
def showEpisodes(): oGui = cGui() params = ParameterHandler() iSeason = int(params.getValue('season')) sThumbnail = params.getValue('sThumbnail') url = params.getValue('entryUrl') sHtmlContent = cRequestHandler(url).request() aResult = cParser().parse(sHtmlContent, "var[ ]subcats[ ]=[ ](.*?);") if not aResult[0] or not aResult[1][0]: return episodes = {} data = json.loads(aResult[1][0]) for key, value in data.items(): SeasonsNr = int(value['info']['staffel']) if SeasonsNr != iSeason: continue episodeNr = int(value['info']['nr']) if episodeNr not in episodes.keys(): episodes.update({episodeNr: key}) isMatchDesc, sDesc = cParser.parseSingleResult( sHtmlContent, '<img[^>]class.*?>(.*?)<br><br>') for sEpisodeNr, sEpisodesID in episodes.items(): oGuiElement = cGuiElement() epiName = data[sEpisodesID]['info']['name'].encode('utf-8') epiName = epiName.split("»")[0].strip() oGuiElement = cGuiElement( str(sEpisodeNr) + " - " + epiName, SITE_IDENTIFIER, 'showHosters') oGuiElement.setEpisode(sEpisodeNr) oGuiElement.setMediaType('episode') if sDesc: oGuiElement.setDescription(sDesc) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sThumbnail) params.setParam('sJsonID', sEpisodesID) oGui.addFolder(oGuiElement, params, bIsFolder=False) oGui.setView('episodes') oGui.setEndOfDirectory()
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() isMatch, aResult = cParser().parse( sHtmlContent, '<a[^>]*data-href="([^"]+)"[^>]*>.*?<span>([^<]*)<\/span>') if not isMatch: return [] hosters = [] for sUrls, sName in aResult: urls = sUrls.split(',') for idx, sLink in enumerate(sUrls.split(',')): hoster = {} hoster['name'] = sName hoster['link'] = sLink hoster['displayedName'] = '%s - Mirror %s' % (sName, idx + 1) hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def getHosterUrl(sUrl=False): username = cConfig().getSetting('serienstream.user') password = cConfig().getSetting('serienstream.pass') oRequestHandler = cRequestHandler(URL_LOGIN, caching=False) oRequestHandler.addHeaderEntry('X-Requested-With', 'XMLHttpRequest') oRequestHandler.addResponse('email', username) oRequestHandler.addResponse('password', password) oRequestHandler.request() if not sUrl.startswith('http'): refUrl = ParameterHandler().getValue('sUrl') oRequest = cRequestHandler(URL_MAIN + sUrl, caching=False) oRequest.addHeaderEntry("Referer", refUrl) oRequest.addHeaderEntry('X-Requested-With', 'XMLHttpRequest') oRequest.request() sUrl = oRequest.getRealUrl() results = [] result = {} result['streamUrl'] = sUrl result['resolved'] = False results.append(result) return results
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() pattern = 'src="([^"]+)"[^>]*frameborder' isMatch, aResult = cParser().parse(sHtmlContent, pattern) hosters = [] if isMatch: for hUrl in aResult: if 'view.php' in hUrl: sHtmlContent = cRequestHandler(hUrl).request() isMatch, aResult = cParser().parse( sHtmlContent, "jbdaskgs[^>]=[^>]'([^']+)") for sUrl in aResult: sUrl = base64.b64decode(sUrl) isMatch, aResult = cParser.parse( sUrl, '"file":"([^"]+).*?label":"([^"]+)') for sUrl, sQuality in aResult: hoster = { 'link': sUrl, 'name': sQuality, 'quality': QUALITY_ENUM[sQuality] } hosters.append(hoster) if 'wp-embed.php' in hUrl: oRequest = cRequestHandler(hUrl) sHtmlContent = oRequest.request() aResult = cParser.parse(sHtmlContent, '<iframe[^>]src="([^"]+)') for sUrl in aResult[1]: isMatch, hname = cParser().parseSingleResult( sUrl, '^(?:https?://)?(?:[^@\n]+@)?([^:/\n]+)') hoster = {'link': sUrl, 'name': hname} hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def showHosters(): sUrl = ParameterHandler().getValue('entryUrl') sHtmlContent = cRequestHandler(sUrl).request() pattern = '<v-flex>[^>]*<v-btn.*?</v-flex>' isMatch, sHtmlContainer = cParser.parse(sHtmlContent, pattern) pattern = '<meta name="csrf-token" content="([^"]+)">' isMatch, token = cParser.parseSingleResult(sHtmlContent, pattern) hosters = [] for a in sHtmlContainer: pattern = 'x">([^<]+)</v-btn>' isMatch, sQuality = cParser.parseSingleResult(a, pattern) pattern = "recaptcha[^>]'([^']+)', '([^']+)', '([^']+).*?" pattern += '">.*?>([^<]+)' isMatch, aResult = cParser().parse(a, pattern) for e, h, sLang, sName in aResult: link = getLinks(sUrl, e, h, token, sLang) hoster = { 'link': link, 'name': sName.strip() + ' ' + sQuality.strip() } hosters.append(hoster) if hosters: hosters.append('getHosterUrl') return hosters
def play(): params = ParameterHandler() if (params.exist('sUrl') and params.exist('sTitle')): sUrl = params.getValue('sUrl') sTitle = params.getValue('sTitle') print sUrl oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = ': "([^\."]+\.flv)"' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sStreamUrl = URL_GET_STREAM + str(aResult[1][0])+'?autostart=true' result = {} result['streamUrl'] = sStreamUrl result['resolved'] = True return result return False
def load(): # Logger-Eintrag logger.info("Load %s" % SITE_NAME) # GUI-Element erzeugen oGui = cGui() # ParameterHandler erzeugen params = ParameterHandler() # Einträge anlegen params.setParam('sUrl', URL_MOVIES) oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showContentMenu'), params) params.setParam('sUrl', URL_SHOWS) oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showContentMenu'), params) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) # Liste abschließen oGui.setEndOfDirectory()