def getVideoLinks(self, videoUrl): printDBG("DarshowCom.getVideoLinks [%s]" % videoUrl) videoUrl = strwithmeta(videoUrl) Referer = videoUrl.meta.get('Referer', '') m1 = '?s=http' if m1 in videoUrl: videoUrl = videoUrl[videoUrl.find(m1) + 3:] if 'dardarkom.com' in videoUrl: sts, data = self.cm.getPage(videoUrl) if not sts: return [] url = '' urlTmpTab = self.cm.ph.getAllItemsBeetwenMarkers( data, '<iframe ', '</iframe>', False, True) printDBG(urlTmpTab) for urlTmp in urlTmpTab: url = self.cm.ph.getSearchGroups( urlTmp, '''location\.href=['"]([^"^']+?)['"]''', 1, True)[0] if 'javascript' in url: url = '' if url == '': url = self.cm.ph.getSearchGroups( data, '''<iframe[^>]+?src=['"]([^"^']+?)['"]''', 1, True)[0] url = self._getFullUrl(url) videoUrl = url urlTab = [] if videoUrl.startswith('http'): urlTab = self.up.getVideoLinkExt( strwithmeta(videoUrl, {'Referer': Referer})) return urlTab
def getVideoLinks(self, baseUrl): printDBG("NaszeKinoTv.getVideoLinks [%s]" % baseUrl) baseUrl = strwithmeta(baseUrl) urlTab = [] # mark requested link as used one if len(self.cacheLinks.keys()): for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if baseUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith( '*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx][ 'name'] + '*' break if 1 == self.up.checkHostSupport(baseUrl): return self.up.getVideoLinkExt(baseUrl) urlParams = dict(self.defaultParams) urlParams['header'] = dict(urlParams['header']) urlParams['header']['Referer'] = baseUrl.meta.get( 'Referer', self.getMainUrl()) sts, data = self.getPage(baseUrl, urlParams) if not sts: return videoUrl = self.getFullUrl( self.cm.ph.getSearchGroups( data, '''<iframe[^>]+?src=['"]([^"^']+?)['"]''', 1, True)[0]) videoUrl = strwithmeta(videoUrl, {'Referer': urlParams['header']['Referer']}) return self.up.getVideoLinkExt(videoUrl)
def getVideoLinks(self, baseUrl): printDBG("SerialeCO.getVideoLinks [%s]" % baseUrl) key = strwithmeta(baseUrl).meta.get('cache_key', '') for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if baseUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith('*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx]['name'] break if 1 != self.up.checkHostSupport(baseUrl): referer = strwithmeta(baseUrl).meta.get('Referer', '') httpParams = dict(self.defaultParams) httpParams['header'] = dict(httpParams['header']) httpParams['header']['Referer'] = referer httpParams['header']['Origin'] = self.getMainUrl()[:-1] sts, data = self.getPage(baseUrl, httpParams) if not sts: return [] baseUrl = self.getFullUrl( self.cm.ph.getSearchGroups( data, '''<iframe[^>]+?src=['"]([^"^']+?)['"]''', 1, True)[0]) return self.up.getVideoLinkExt(self.getFullUrl(baseUrl))
def getLinksForVideo(self, cItem): printDBG("BajeczkiOrg.getLinksForVideo [%s]" % cItem) urlTab = self.cacheLinks.get(cItem['url'], []) if len(urlTab): return urlTab self.cacheLinks = {} sts, data = self.getPage(cItem['url']) if not sts: return data = self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', 'entry-content'), ('<button', '>'))[1] data = re.sub("<!--[\s\S]*?-->", "", data) tmp = self.cm.ph.getDataBeetwenMarkers(data, '<video', '</video>', caseSensitive=False)[1] tmp = self.cm.ph.getAllItemsBeetwenMarkers(tmp, '<source', '>', caseSensitive=False) for item in tmp: url = self.getFullUrl(self.cm.ph.getSearchGroups(item, '''src=['"]([^'^"]+?)['"]''', ignoreCase=True)[0]) type = self.cm.ph.getSearchGroups(item, '''type=['"]([^'^"]+?)['"]''', ignoreCase=True)[0].lower() if 'mp4' in type: name = self.up.getDomain(url) urlTab.append({'name':name, 'url':strwithmeta(url, {'direct_link':True, 'Referer':cItem['url']}), 'need_resolve':1}) tmp = self.cm.ph.getAllItemsBeetwenMarkers(data, '<iframe', '>', caseSensitive=False) for item in tmp: url = self.getFullUrl(self.cm.ph.getSearchGroups(item, '''src=['"]([^'^"]+?)['"]''', ignoreCase=True)[0]) if 1 == self.up.checkHostSupport(url): name = self.up.getDomain(url) urlTab.append({'name':name, 'url':strwithmeta(url, {'Referer':cItem['url']}), 'need_resolve':1}) if len(urlTab): self.cacheLinks[cItem['url']] = urlTab return urlTab
def getVideoLink(self, cItem): printDBG("UstvnowApi.getVideoLink %s" % cItem) ######################## #url = 'http://lv2.ustvnow.com/iphone_ajax?tab=iphone_playingnow&token=' + self.token #sts, data = self.cm.getPage(url, self.defParams) #return #printDBG(data) ######################## #sts, data = self.cm.getPage('https://watch.ustvnow.com/account/signin') #printDBG(data) #return [] urlsTab = [] cookieParams = {'cookiefile': self.cookiePath, 'use_cookie': True, 'load_cookie':True, 'save_cookie':True} sts, data = self.cm.getPage('http://m-api.ustvnow.com/stream/1/live/view?scode=%s&token=%s&key=%s' % (cItem.get('scode', ''), self.token, self.passkey), self.defParams) if sts: try: data = byteify(json.loads(data)) tmp = getDirectM3U8Playlist(strwithmeta(data['stream'], {'User-Agent':self.HTTP_HEADER['User-Agent']}), cookieParams=cookieParams, checkContent=True) cookieValue = self.cm.getCookieHeader(self.cookiePath) for item in tmp: vidUrl = item['url']#.replace('/smil:', '/mp4:').replace('USTVNOW/', 'USTVNOW1/') item['url'] = urlparser.decorateUrl(vidUrl, {'User-Agent':self.HTTP_HEADER['User-Agent'], 'Cookie':cookieValue}) urlsTab.append(item) if len(urlsTab): return urlsTab except Exception: printExc() #sts, data = self.cm.getPage(cItem['priv_url'], self.defParams) sts, data = self.cm.getPage(self.LIVE_URL, self.defParams) if not sts: return [] url = self.cm.ph.getSearchGroups(data, 'for="popup-%s"[^>]*?href="([^"]+?)"[^>]*?>' % cItem['ui_page'])[0] url = self.getFullUrl(url) sts, data = self.cm.getPage(url, self.defParams) if not sts: return [] url = self.cm.ph.getSearchGroups(data, 'src="([^"]+?)"')[0] tmp = getDirectM3U8Playlist(strwithmeta(url, {'User-Agent':self.HTTP_HEADER['User-Agent']}), cookieParams=cookieParams, checkContent=True) cookieValue = self.cm.getCookieHeader(self.cookiePath) for item in tmp: vidUrl = item['url']#.replace('/smil:', '/mp4:').replace('USTVNOW/', 'USTVNOW1/') item['url'] = urlparser.decorateUrl(vidUrl, {'User-Agent':self.HTTP_HEADER['User-Agent'], 'Cookie':cookieValue}) urlsTab.append(item) return urlsTab
def getFullIconUrl(self, url): m1 = 'amp;url=' if m1 in url: url = url.split(m1)[-1] url = self.getFullUrl(url) proxy = config.plugins.iptvplayer.solarmovie_proxy.value if proxy != 'None': if proxy == 'proxy_1': proxy = config.plugins.iptvplayer.alternative_proxy1.value else: proxy = config.plugins.iptvplayer.alternative_proxy2.value url = strwithmeta(url, {'iptv_http_proxy':proxy}) cookieHeader = self.cm.getCookieHeader(self.COOKIE_FILE) return strwithmeta(url, {'Cookie':cookieHeader, 'User-Agent':self.USER_AGENT})
def getLinksForVideo(self, cItem): printDBG("KreskowkaZonePL.getLinksForVideo [%s]" % cItem) urlTab = [] if cItem['url'] in self.cacheLinks: return self.cacheLinks[cItem['url']] sts, data = self.cm.getPage(cItem['url'], self.defaultParams) if not sts: return [] varName = self.cm.ph.getSearchGroups( data, '''var\s*__gaq\s*=\s*['"]([^'^"]+?)['"]''')[0] data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<tr class="wiersz">', '</tr>', withMarkers=True) for item in data: url = self.cm.ph.getSearchGroups( item, '''%s=['"]([^'^"]+?)['"]''' % varName)[0] tmp = self.cm.ph.getAllItemsBeetwenMarkers(item, '<td ', '</td>', withMarkers=True) title = self.cleanHtmlStr(' '.join(tmp)) url = strwithmeta(url, {'origin_url': cItem['url']}) urlTab.append({'name': title, 'url': url, 'need_resolve': 1}) self.cacheLinks[cItem['url']] = urlTab return urlTab
def listItems(self, cItem, nextCategory): printDBG("MaxtvGO.listItems [%s]" % cItem) sts, data = self.getPage(cItem['url']) if not sts: return article = self.getArticleContent(cItem, data) if len(article): title = article[0]['title'] icon = article[0]['images'][0]['url'] params = dict(cItem) params.update({'good_for_fav': True, 'title': title, 'icon': icon}) self.addVideo(params) cookieHeader = self.cm.getCookieHeader(self.COOKIE_FILE) catsTitle = '' data = self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', 'slajder_film'), ('<div', '>', 'chat_round'))[1] data = re.compile('(<h3[^>]*?>[^>]*?</[^>]*?>)').split(data) for catData in data: if catData.startswith('<h3'): catsTitle = self.cleanHtmlStr(catData) tmp = self.cm.ph.getAllItemsBeetwenMarkers(catData, '<a', '</a>') for item in tmp: url = self.getFullUrl( self.cm.ph.getSearchGroups( item, '''href=['"]([^'^"]+?)['"]''')[0]) icon = self.getFullIconUrl( self.cm.ph.getSearchGroups( item, '''src=['"]([^'^"]+?)['"]''')[0]) icon = strwithmeta( icon, { 'Cookie': cookieHeader, 'User-Agent': self.USER_AGENT, 'Referer': cItem['url'] }) title = self.cleanHtmlStr( self.cm.ph.getSearchGroups( item, '''alt=['"]([^'^"]+?)['"]''')[0]) if title == '': title = catsTitle + ' ' + self.cleanHtmlStr( icon.split('/')[-1].split('.', 1)[0].replace( 'small', '')) # 'category':nextCategory, params = dict(cItem) params.update({ 'good_for_fav': True, 'title': title, 'url': url, 'icon': icon }) self.addVideo(params) if self.loggedIn != True and 0 == len(self.currList): msg = _( 'The host %s requires registration. \nPlease fill your login and password in the host configuration. Available under blue button.' % self.getMainUrl()) GetIPTVNotify().push(msg, 'error', 10) SetIPTVPlayerLastHostError(msg)
def getVideoLinks(self, videoUrl): printDBG("PlusDEDE.getVideoLinks [%s]" % videoUrl) videoUrl = strwithmeta(videoUrl) urlTab = [] # mark requested link as used one if len(self.cacheLinks.keys()): for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if videoUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith('*'): self.cacheLinks[key][idx]['name'] = '*' + self.cacheLinks[key][idx]['name'] + '*' break sts, data = self.getPage(videoUrl) if not sts: return [] data = self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', 'visit-buttons'), ('</div', '>'))[1] videoUrl = self.getFullUrl(self.cm.ph.getSearchGroups(data, '''href=['"]([^'^"]+?)['"]''')[0]) if self.cm.isValidUrl(videoUrl): params = dict(self.defaultParams) params['return_data'] = False try: sts, response = self.getPage(videoUrl, params) videoUrl = response.geturl() response.close() except Exception: printExc() printDBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> videoUrl[%s]" % videoUrl) urlTab = self.up.getVideoLinkExt(videoUrl) return urlTab
def getLinksForVideo(self, cItem): printDBG("SKStream.getLinksForVideo [%s]" % cItem) urlTab = self.cacheLinks.get(cItem['url'], []) if len(urlTab): return urlTab sts, data = self.getPage(cItem['url']) if not sts: return [] urlTab = [] data = self.cm.ph.getDataBeetwenMarkers(data, '<tbody>', '</tbody>')[1] data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<tr', '</tr>') for item in data: linksTab = [] playerUrl = self.getFullUrl(self.cm.ph.getSearchGroups(item, '''data-embedlien=['"]([^'^"]+?)['"]''')[0]) if self.cm.isValidUrl(playerUrl): linksTab.append(playerUrl) playerUrl = self.getFullUrl(self.cm.ph.getSearchGroups(item, '''data-basicurl=['"]([^'^"]+?)['"]''')[0]) if self.cm.isValidUrl(playerUrl): linksTab.append(playerUrl) if 0 == len(linksTab): continue nameTab = [] tmp = self.cm.ph.getAllItemsBeetwenMarkers(item, '<td', '</td>') for n in tmp: n = self.cleanHtmlStr(n) if n != '': nameTab.append(n) url = strwithmeta('|><|'.join(linksTab), {'Referer':cItem['url']}) urlTab.append({'name':' | '.join(nameTab), 'url':url, 'need_resolve':1}) if len(urlTab): self.cacheLinks[cItem['url']] = urlTab return urlTab
def getVideoLink(self, cItem): printDBG("GoldVodTVApi.getVideoLink") if self.loggedIn: url = strwithmeta(cItem['url'], {'params': {'load_cookie': True}}) else: url = cItem['url'] return self.up.getVideoLinkExt(url)
def getVideoLink(self, cItem): printDBG("YooanimeComApi.getVideoLink") urlsTab = [] if len(cItem['url']) < 3: return [] sts, data = self.cm.getPage(self.MAIN_URL, self.http_params) if not sts: return [] data = self.cm.ph.getDataBeetwenMarkers(data, 'li.channel', '$(document)', False)[1] printDBG(data) url = self.getFullUrl(self._getAttrVal(data, 'url')) token = self._getAttrVal(data, 'token') ip = self._getAttrVal(data, 'ip') channel = cItem['url'][2:] post_data = {'token': token, 'ip': ip, 'channel': channel} http_params = dict(self.http_params) http_params['header'] = dict(self.AJAX_HEADER) http_params['header']['Referer'] = self.MAIN_URL sts, data = self.cm.getPage(url, http_params, post_data) if not sts: return [] videoUrl = self._getAttrVal(data, 'ipadUrl') videoUrl = strwithmeta(videoUrl, { 'Referer': self.MAIN_URL, 'User-Agent': self.HEADER['User-Agent'] }) urlsTab = getDirectM3U8Playlist(videoUrl, checkContent=True) return urlsTab
def getVideoLinks(self, videoUrl): printDBG("CineTO.getVideoLinks [%s]" % videoUrl) videoUrl = strwithmeta(videoUrl) urlTab = [] # mark requested link as used one if len(self.cacheLinks.keys()): for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if videoUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith( '*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx][ 'name'] break sts, data = self.getPage(videoUrl) if sts: videoUrl = data.meta['url'] urlTab = self.up.getVideoLinkExt(videoUrl) if 0 == len(urlTab) and 'gcaptchaSetup' in data: SetIPTVPlayerLastHostError( _('Link protected with google recaptcha v2.')) else: urlTab = self.up.getVideoLinkExt(videoUrl) return urlTab
def getVideoLinks(self, videoUrl): printDBG("getVideoLinks [%s]" % videoUrl) videoUrl = strwithmeta(videoUrl) urlTab = [] orginUrl = str(videoUrl) # mark requested link as used one if len(self.cacheLinks.keys()): for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if videoUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith( '*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx][ 'name'] break if 1 != self.up.checkHostSupport(videoUrl): try: httpParams = dict(self.defaultParams) httpParams['return_data'] = False sts, response = self.cm.getPage(videoUrl, httpParams) videoUrl = response.geturl() response.close() except Exception: printExc() return [] if self.up.getDomain( self.getMainUrl()) in videoUrl or self.up.getDomain( videoUrl) == self.up.getDomain(orginUrl): sts, data = self.getPage(videoUrl) if not sts: return [] found = False printDBG(data) tmp = re.compile('''<iframe[^>]+?src=['"]([^"^']+?)['"]''', re.IGNORECASE).findall(data) for url in tmp: if 1 == self.up.checkHostSupport(url): videoUrl = url found = True break if not found or 'flashx' in videoUrl: tmp = self.cm.ph.getAllItemsBeetwenMarkers( data, 'embedFrame', '</a>') for urlItem in tmp: url = self.cm.ph.getSearchGroups( urlItem, '''href=['"](https?://[^'^"]+?)['"]''')[0] if 1 == self.up.checkHostSupport(url): videoUrl = url found = True break if self.cm.isValidUrl(videoUrl): urlTab = self.up.getVideoLinkExt(videoUrl) return urlTab
def getLinksForVideo(self, cItem): printDBG("OroroTV.getLinksForVideo [%s]" % cItem) retTab = [] sts, data = self.getPage(cItem['url']) if not sts: return [] data = self.cm.ph.getDataBeetwenMarkers(data, '<video', '</video>')[1] tmp = self.cm.ph.getDataBeetwenMarkers(data, '<source', '>')[1] videoUrl = self.cm.ph.getSearchGroups(tmp, '''src=['"](https?://[^'^"]+?)['"]''')[0] type = self.cm.ph.getSearchGroups(tmp, '''type=['"]([^'^"]+?)['"]''')[0] retTab = self.up.getVideoLinkExt(videoUrl) if 0 == len(retTab): return [] subTracks = [] tmp = self.cm.ph.getAllItemsBeetwenMarkers(data, '<track', '>') for item in tmp: if 'subtitles' not in item: continue url = self.cm.ph.getSearchGroups(item, '''src=['"](https?://[^'^"]+?)['"]''')[0] lang = self.cm.ph.getSearchGroups(item, '''label=['"]([^'^"]+?)['"]''')[0] title = self.cm.ph.getSearchGroups(item, '''title=['"]([^'^"]+?)['"]''')[0] if url != '': subTracks.append({'title':title, 'url':url, 'lang':lang, 'format':url[-3:]}) if len(subTracks): for idx in range(len(retTab)): tmp = list(subTracks) tmp.extend(retTab[idx]['url'].meta.get('external_sub_tracks', [])) retTab[idx]['url'] = strwithmeta(retTab[idx]['url'], {'external_sub_tracks':list(tmp)}) return retTab
def exploreItem(self, cItem): printDBG("PutlockerTvTo.exploreItem") sts, data = self.getPage(cItem['url']) if not sts: return titlesTab = [] self.cacheLinks = {} data = self.cm.ph.getDataBeetwenMarkers(data, '<div id="servers">', '<div class="widget')[1] data = data.split('<div class="server row"') for tmp in data: serverName = self.cleanHtmlStr(self.cm.ph.getDataBeetwenMarkers(tmp, '<label', '</label>')[1]) serverId = self.cm.ph.getSearchGroups(tmp, '''data-id=['"]([^'^"]+?)['"]''')[0] tmp = self.cm.ph.getAllItemsBeetwenMarkers(tmp, '<li', '</li>') for item in tmp: title = self.cleanHtmlStr(item) id = self.cm.ph.getSearchGroups(item, '''data-id=['"]([^'^"]+?)['"]''')[0] url = self.getFullUrl(self.cm.ph.getSearchGroups(item, '''href=['"]([^'^"]+?)['"]''')[0]) if title not in titlesTab: titlesTab.append(title) self.cacheLinks[title] = [] url = strwithmeta(url, {'id':id, 'server_id':serverId}) self.cacheLinks[title].append({'name':serverName, 'url':url, 'need_resolve':1}) for item in titlesTab: params = dict(cItem) params.update({'good_for_fav': False, 'title':'%s : %s' % (cItem['title'], item), 'links_key':item}) self.addVideo(params)
def decorateUrl(url, metaParams={}): retUrl = strwithmeta(url) retUrl.meta.update(metaParams) urlLower = url.lower() if 'iptv_proto' not in retUrl.meta: if urlLower.startswith('merge://'): retUrl.meta['iptv_proto'] = 'merge' elif urlLower.split('?')[0].endswith('.m3u8'): retUrl.meta['iptv_proto'] = 'm3u8' elif urlLower.split('?')[0].endswith('.f4m'): retUrl.meta['iptv_proto'] = 'f4m' elif 'protocol=hls' in urlLower: retUrl.meta['iptv_proto'] = 'm3u8' elif urlLower.split('?')[0].endswith('.mpd'): retUrl.meta['iptv_proto'] = 'mpd' elif urlLower.startswith('rtmp'): retUrl.meta['iptv_proto'] = 'rtmp' elif urlLower.startswith('https'): retUrl.meta['iptv_proto'] = 'https' elif urlLower.startswith('http'): retUrl.meta['iptv_proto'] = 'http' elif urlLower.startswith('file'): retUrl.meta['iptv_proto'] = 'file' elif urlLower.startswith('rtsp'): retUrl.meta['iptv_proto'] = 'rtsp' elif urlLower.startswith('mms'): retUrl.meta['iptv_proto'] = 'mms' elif urlLower.startswith('mmsh'): retUrl.meta['iptv_proto'] = 'mmsh' return retUrl
def getLinksForVideo(self, cItem): printDBG("AlltubeTV.getLinksForVideo [%s]" % cItem) urlTab = [] cacheKey = cItem['url'] urlTab = self.cacheLinks.get(cacheKey, []) if len(urlTab): return urlTab sts, data = self.getPage(cItem['url']) if not sts: return urlTab data = self.cm.ph.getDataBeetwenNodes(data, ('<table', '>'), ('</table', '>'), False)[1] data = data.split('</tr>') if len(data): del data[-1] for item in data: try: url = self.cm.ph.getSearchGroups(item, '''data\-iframe=['"]([^"^']+?)['"]''')[0] if url != '': url = base64.b64decode(url) else: url = self.cm.ph.getSearchGroups(item, '''href=['"]([^"^']*?link/[^"^']+?)['"]''')[0] name = self.cleanHtmlStr(item) urlTab.append({'name':name, 'url':strwithmeta(url, {'cache_key':cacheKey}), 'need_resolve':1}) except Exception: printExc() if len(urlTab): self.cacheLinks[cacheKey] = urlTab return urlTab
def getLinksForVideo(self, cItem): printDBG("FilmStreamHD.getLinksForVideo [%s]" % cItem) urlTab = [] sts, data = self.getPage(cItem['url']) if not sts: return cUrl = data.meta['url'] self.setMainUrl(cUrl) data = self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', '-player-'), ('</script', '>'), False)[1] data = self.cm.ph.getDataBeetwenMarkers(data, '"source"', ']')[1] data = re.compile( '''['"]url['"]\s*?:\s*?['"]([^'^"]+?)['"]''').findall(data) for item in data: url = self.getFullUrl(item.replace('\\/', '/')) urlTab.append({ 'name': self.up.getHostName(url), 'url': strwithmeta(url, { 'Referer': cUrl, 'User-Agent': self.USER_AGENT }), 'need_resolve': 0 }) return urlTab
def listLiveStreams(self, cItem): printDBG("WatchwrestlingUNO.listLiveStreams [%s]" % cItem) sts, data = self.cm.getPage(cItem['url']) if not sts: return baseUrl = self.cm.ph.getSearchGroups( data, '''<base[^>]+?href=["'](https?://[^"^']+?)['"]''')[0] sp = '<div style="text-align: center;">' data = self.cm.ph.getDataBeetwenMarkers( data, '<p style="text-align: center;"><a', '</p>')[1] data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<a', '</a>', True) for item in data: title = self.cleanHtmlStr(item) url = urlparse.urljoin( baseUrl, self.cm.ph.getSearchGroups(item, '''href=["']([^"^']+?)['"]''')[0]) params = dict(cItem) params.update({ 'good_for_fav': False, 'title': title, 'url': strwithmeta(url, { 'live': True, 'Referer': cItem['url'] }), 'live': True }) self.addVideo(params)
def runMovePlayer(self): # this shoudl not happen but to make sure if not self.canRunMoviePlayer: printDBG('called runMovePlayer with canRunMoviePlayer set to False') return self.inMoviePlayer = True buffSize = self.downloader.getLocalFileSize() - self.lastSize printDBG("Run MoviePlayer with buffer size [%s]" % formatBytes(float(buffSize)) ) self.setMainTimerSts(False) player = self.activMoviePlayer printDBG('IPTVPlayerBufferingWidget.runMovePlayer [%r]' % player) playerAdditionalParams = dict(self.playerAdditionalParams) playerAdditionalParams['downloader'] = self.downloader if self.isMOOVAtomAtTheBeginning: playerAdditionalParams['moov_atom_info'] = {'offset':0, 'size':self.moovAtomOffset + self.moovAtomSize, 'file':''} elif self.moovAtomStatus == self.MOOV_STS.DOWNLOADED and \ DMHelper.STS.DOWNLOADED != self.downloader.getStatus(): playerAdditionalParams['moov_atom_info'] = {'offset':self.moovAtomOffset, 'size': self.moovAtomSize, 'file':self.moovAtomPath} if strwithmeta(self.url).meta.get('iptv_proto', '') in ['f4m', 'uds', 'm3u8']: playerAdditionalParams['file-download-timeout'] = 90000 # 90s else: playerAdditionalParams['file-download-timeout'] = 10000 # 10s playerAdditionalParams['file-download-live'] = self._isInLiveMode() if "mini" == player: self.session.openWithCallback(self.leaveMoviePlayer, IPTVMiniMoviePlayer, self.filePath, self.movieTitle, self.lastPosition, 4) elif "exteplayer" == player: self.session.openWithCallback(self.leaveMoviePlayer, IPTVExtMoviePlayer, self.filePath, self.movieTitle, self.lastPosition, 'eplayer', playerAdditionalParams) elif "extgstplayer" == player: self.session.openWithCallback(self.leaveMoviePlayer, IPTVExtMoviePlayer, self.filePath, self.movieTitle, self.lastPosition, 'gstplayer', playerAdditionalParams) else: self.session.openWithCallback(self.leaveMoviePlayer, IPTVStandardMoviePlayer, self.filePath, self.movieTitle) playerAdditionalParams = None
def getLinksForVideo(self, cItem): printDBG("TfarjoCom.getLinksForVideo [%s]" % cItem) if 1 == self.up.checkHostSupport(cItem.get('url', '')): videoUrl = cItem['url'].replace('youtu.be/', 'youtube.com/watch?v=') return self.up.getVideoLinkExt(videoUrl) cacheKey = cItem['url'] cacheTab = self.cacheLinks.get(cacheKey, []) if len(cacheTab): return cacheTab self.cacheLinks = {} sts, data = self.getPage(cItem['url']) if not sts: return cUrl = data.meta['url'] self.setMainUrl(cUrl) tmp = self.cm.ph.getDataBeetwenMarkers(data, 'function getIframe', '</script>')[1] linkUrl = self.getFullUrl( self.cm.ph.getSearchGroups( tmp, '''['"]?url['"]?\s*?:\s*?['"]([^'^"]+?)['"]''')[0]) if '/film/' in cUrl: itemType = 'movie' else: itemType = 'episode' linkTest = self.cm.ph.getSearchGroups( data, '''['"]?csrf_test_name['"]?\s*?:\s*?['"]([^'^"]+?)['"]''')[0] retTab = [] data = re.sub("<!--[\s\S]*?-->", "", data) data = self.cm.ph.getAllItemsBeetwenNodes( data, ('<button', '>', 'getIframe'), ('</button', '>')) for item in data: name = self.cleanHtmlStr(item) verType = self.cm.ph.getSearchGroups( item, '''class=['"]players([^'^"]+?)['"]''')[0].upper() linkData = self.cm.ph.getDataBeetwenMarkers( item, 'getIframe(', ')', False)[1].strip()[1:-1] url = linkUrl + '#' + linkData retTab.append({ 'name': '[%s] %s' % (verType, name), 'url': strwithmeta( url, { 'Referer': cUrl, 'iptv_link_data': linkData, 'iptv_link_test': linkTest, 'iptv_link_type': itemType }), 'need_resolve': 1 }) if len(retTab): self.cacheLinks[cacheKey] = retTab return retTab
def getLinksForVideo(self, cItem): printDBG("Cinemay.getLinksForVideo [%s]" % cItem) retTab = [] if 1 == self.up.checkHostSupport(cItem.get('url', '')): videoUrl = cItem['url'].replace('youtu.be/', 'youtube.com/watch?v=') return self.up.getVideoLinkExt(videoUrl) cacheKey = cItem['url'] cacheTab = self.cacheLinks.get(cacheKey, []) if len(cacheTab): return cacheTab sts, data = self.getPage(cItem['url']) if not sts: return [] id = '' header = {'Referer': cItem['url']} data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<script', '</script>') for item in data: if 'headers' in item: id = self.cm.ph.getSearchGroups( item, '''['"]?id['"]?\s*:\s*['"]([^'^"]+?)['"]''')[0] tmp = self.cm.ph.getDataBeetwenMarkers(item, 'headers', '}')[1] tmp = self.cm.ph.getSearchGroups( tmp, '''\{\s*['"]?([^'^"]+?)['"]?\s*:\s*['"]([^'^"]+?)['"]''', 2) header[tmp[0]] = tmp[1] if id == '': return [] params = dict(self.defaultParams) params['header'] = dict(params['header']) params['header'].update(header) url = self.getFullUrl("playery/?id=" + id) sts, data = self.getPage(url, params) if not sts: return [] data = self.cm.ph.getDataBeetwenMarkers(data, 'linktabslink', '</ul>')[1] data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<li', '</li>') for item in data: lang = self.cm.ph.getSearchGroups(item, '''/flags/(.+?)\.png''')[0] name = self.cleanHtmlStr(item) url = self.getFullUrl( self.cm.ph.getSearchGroups(item, '''value=['"]([^'^"]+?)['"]''')[0]) retTab.append({ 'name': '[%s] %s' % (lang, name), 'url': strwithmeta(url, {'Referer': cItem['url']}), 'need_resolve': 1 }) if len(retTab): self.cacheLinks[cacheKey] = retTab return retTab
def getVideoLinks(self, videoUrl): printDBG("HDStreams.getVideoLinks [%s]" % videoUrl) meta = strwithmeta(videoUrl).meta linksKey = meta.get('links_key', '') post_data = meta.get('post_data', {}) for idx in range(len(self.cacheLinks[linksKey])): if self.cacheLinks[linksKey][idx]['url'].meta[ 'links_key'] == linksKey: tmp_post = self.cacheLinks[linksKey][idx]['url'].meta.get( 'post_data', {}) if tmp_post == post_data: if not self.cacheLinks[linksKey][idx]['name'].startswith( '*'): self.cacheLinks[linksKey][idx][ 'name'] = '*' + self.cacheLinks[linksKey][idx][ 'name'] break sts, data = self.getPage(videoUrl) if not sts: return [] urlParams = dict(self.defaultParams) urlParams['header'] = dict(self.AJAX_HEADER) urlParams['header']['Referer'] = videoUrl urlParams['header']['x-csrf-token'] = self.cm.ph.getSearchGroups( data, '''<[^>]+?csrf-token[^>]+?content=['"]([^'^"]+?)['"]''')[0] urlParams['header']['x-xsrf-token'] = self.cm.getCookieItem( self.COOKIE_FILE, 'XSRF-TOKEN') urlParams['header']['x-requested-with'] = 'XMLHttpRequest' urlParams['ignore_http_code_ranges'] = [(401, 401)] sts, data = self.getPage(videoUrl + '/stream', urlParams, post_data) if not sts: return [] if 'captcha' in data.lower(): SetIPTVPlayerLastHostError( _('Link protected with google recaptcha v2.')) try: printDBG(data) tmp = byteify(json.loads(data))['s'] if '{' not in tmp: tmp = base64.b64decode(tmp) tmp = byteify(json.loads(tmp)) printDBG(tmp) ciphertext = base64.b64decode(tmp['ct'][::-1]) iv = unhexlify(tmp['iv']) salt = unhexlify(tmp['s']) b = urlParams['header'][ 'x-csrf-token'] #urlParams['header']['User-Agent'] tmp = self.cryptoJS_AES_decrypt(ciphertext, base64.b64encode(b), salt) printDBG(tmp) tmp = byteify(json.loads(tmp)) videoUrl = tmp except Exception: printExc() return self.up.getVideoLinkExt(videoUrl)
def getLinksForVideo(self, cItem): printDBG("IceFilms.getLinksForVideo [%s]" % cItem) urlTab = [] if len(self.cacheLinks.get(cItem['url'], [])): return self.cacheLinks[cItem['url']] rm(self.COOKIE_FILE) sts, data = self.getPage(cItem['url'], self.defaultParams) if not sts: return [] url = self.getFullUrl( self.cm.ph.getSearchGroups( data, '''<iframe[^>]+?src=['"]([^"^']+?)['"]''', 1, True)[0]) url = self.getFullUrl(url) sts, data = self.getPage(url, self.defaultParams) if not sts: return [] data = self.cm.ph.getDataBeetwenMarkers(data, 'id="srclist"', 'These links brought')[1] data = self.cm.ph.getAllItemsBeetwenMarkers(data, 'ripdiv', '</div>') for item in data: mainTitle = self.cleanHtmlStr( self.cm.ph.getDataBeetwenMarkers(item, '<b', '</b>')[1]) sourcesTab = self.cm.ph.getAllItemsBeetwenMarkers( item, '<a', '</i>') for source in sourcesTab: sourceId = self.cm.ph.getSearchGroups( source, '''onclick=['"]go\((\d+)\)['"]''')[0] if sourceId == '': continue sourceName = self.cleanHtmlStr( clean_html(source.replace('</a>', ' '))) # hostings filter # do not add hostings wich require captcha add = True for notSup in [ ' uploadx ', ' uploadz ', ' owndrives ', ' upload ', ' suprafiles' ]: if notSup in (' %s ' % sourceName.lower()): add = False break if not add: continue # end hostings filter urlTab.append({ 'name': '[{0}] {1}'.format(mainTitle, sourceName), 'url': strwithmeta(sourceId, {'url': cItem['url']}), 'need_resolve': 1 }) self.cacheLinks[cItem['url']] = urlTab return urlTab
def getFullIconUrl(self, url): url = self.getFullUrl(url) if url == '': return '' cookieHeader = self.cm.getCookieHeader(self.COOKIE_FILE) return strwithmeta(url, { 'Cookie': cookieHeader, 'User-Agent': self.USER_AGENT })
def getVideoLinks(self, videoUrl): printDBG("MyTheWatchseries.getVideoLinks [%s]" % videoUrl) linksTab = [] videoUrl = strwithmeta(videoUrl) key = videoUrl.meta.get('links_key', '') if key != '': if key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if self.cacheLinks[key][idx][ 'url'] == videoUrl and not self.cacheLinks[key][ idx]['name'].startswith('*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx]['name'] urlParams = dict(self.defaultParams) urlParams['header'] = dict(urlParams['header']) urlParams['header']['Referer'] = videoUrl.meta.get('Referer', key) if self.up.getDomain(self.getMainUrl()) in videoUrl: sts, data = self.getPage(videoUrl, urlParams) printDBG(data) if sts: tmp = self.cm.ph.getDataBeetwenMarkers(data, '<video', '</video>')[1] tmp = self.cm.ph.getAllItemsBeetwenMarkers(tmp, '<source', '>') for item in tmp: printDBG(item) label = self.cm.ph.getSearchGroups( item, '''label=['"]([^'^"]+?)['"]''')[0] type = self.cm.ph.getSearchGroups( item, '''type=['"]([^'^"]+?)['"]''')[0] url = self.cm.ph.getSearchGroups( item, '''src=['"](https?://[^'^"]+?)['"]''')[0] if self.cm.isValidUrl(url) and 'mp4' in type: linksTab.append({'name': label, 'url': url}) videoUrl = self.cm.ph.getSearchGroups( data, '''<iframe[^>]+?src=['"](https?://[^"]+?)['"]''', 1, True)[0] if 0 == len(linksTab): videoUrl = strwithmeta(videoUrl, {'Referer': self.getMainUrl()}) linksTab = self.up.getVideoLinkExt(videoUrl) return linksTab
def getIconUrl(self, url, refreshCookieHeader=True): url = self.getFullUrl(url) if url == '': return '' if refreshCookieHeader: self.refreshCookieHeader() return strwithmeta(url, { 'Cookie': self.cookieHeader, 'User-Agent': self.USER_AGENT })
def getSeasonsList(self, pageUrl): printDBG('HdgoccParser.getSeasonsList') seasonsTab = [] refUrl = strwithmeta(pageUrl).meta.get('Referer', pageUrl) params = copy.deepcopy(self.defaultParams) params['header']['Referer'] = refUrl params['with_metadata'] = True sts, data = self.cm.getPage(pageUrl, params) if not sts: return [] urlNext = self.cm.ph.getSearchGroups(data, '<iframe[^>]+?src="([^"]+?)"', 1, True)[0] urlNext = self.getFullUrl(data.meta['url'], urlNext) if self.cm.isValidUrl(urlNext): params['header']['Referer'] = pageUrl sts, data = self.cm.getPage(urlNext, params) if not sts: return [] seasonData = self.cm.ph.getDataBeetwenMarkers(data, 'id="season"', '</select>', False)[1] printDBG(seasonData) seasonData = re.compile( '<option[^>]+?value="([0-9]+?)">([^<]+?)</option>').findall( seasonData) seasonMainUrl = self.cm.ph.getDataBeetwenMarkers( data, "$('#season').val();", '});', False)[1] seasonMainUrl = self.cm.ph.getSearchGroups(seasonMainUrl, "var url = '([^']+?)'")[0] if seasonMainUrl == '': seasonMainUrl = pageUrl.split('?', 1)[0] seasonMainUrl += '?season=' seasonMainUrl = self.getFullUrl(pageUrl, seasonMainUrl) for item in seasonData: seasonsTab.append({ 'title': item[1], 'id': int(item[0]), 'url': strwithmeta(seasonMainUrl + item[0], {'Referer': refUrl}) }) seasonsTab.sort(key=lambda item: item['id']) return seasonsTab
def exploreLink(self, cItem, category, url, desc=''): title = cItem['title'] params = dict(cItem) params['desc'] = desc params['url'] = url hostName = self.up.getHostName(url) if hostName in ['serpens.nl', '37.220.36.15']: hostName = 'moonwalk.cc' params.update({'category': category, 'serie_title': title}) if hostName == 'moonwalk.cc' and '/serial/' in url: seasons = self.moonwalkParser.getSeasonsList(url) for item in seasons: param = dict(params) param.update({ 'host_name': 'moonwalk', 'title': item['title'], 'season_id': item['id'], 'url': item['url'] }) self.addDir(param) return elif hostName == 'hdgo.cc': url = strwithmeta(url, {'Referer': cItem['url']}) seasons = self.hdgocc.getSeasonsList(url) for item in seasons: param = dict(params) param.update({ 'host_name': 'hdgo.cc', 'title': item['title'], 'season_id': item['id'], 'url': item['url'] }) self.addDir(param) if 0 != len(seasons): return seasonUrl = url episodes = self.hdgocc.getEpiodesList(seasonUrl, -1) for item in episodes: param = dict(params) param.update({ 'title': '{0} - {1} - s01e{2} '.format(title, item['title'], item['id']), 'url': item['url'] }) self.addVideo(param) if 0 != len(episodes): return if 1 == self.up.checkHostSupport(url): self.addVideo(params)