def getLinksForVideo(self, cItem): url = cItem['url'] printDBG("RtlMostHU.getLinksForVideo url[%s]" % url) videoUrls = [] if not self.tryTologin(): return videoUrls sts, data = self.cm.getPage(self.VIDEO_URL.format( url), self.apiParams) if not sts: return videoUrls try: data = json_loads(data) assets = data['clips'][0].get('assets') url = assets[0].get('full_physical_path'); except Exception: printExc() uri = urlparser.decorateParamsFromUrl(url) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name':'direct link', 'url':uri}) return videoUrls
def ParseM3u(data): printDBG('ParseM3u') list = [] data = data.replace("\r","\n").replace('\n\n', '\n').split('\n') printDBG(">>>>>>>>>>>>> data0[%s]" % data[0]) if '#EXTM3U' not in data[0]: return list params = {'title':'', 'length':'', 'uri':''} for line in data: line = line.strip() printDBG(line) if line.startswith('#EXTINF:'): try: length, title = line.split('#EXTINF:')[1].split(',', 1) params = {'title':title, 'length':length, 'uri':''} except: printExc() params = {'title':'', 'length':'', 'uri':''} else: if '' != params['title']: line = line.replace('rtmp://$OPT:rtmp-raw=', '') cTitle = re.sub('\[[^\]]*?\]', '', params['title']) if len(cTitle): params['title'] = cTitle params['uri'] = urlparser.decorateParamsFromUrl(line) list.append(params) params = {'title':'', 'length':'', 'uri':''} return list
def getLinksForVideo(self, cItem): printDBG("Urllist.getLinksForVideo url[%s]" % cItem['url']) videoUrls = [] uri = urlparser.decorateParamsFromUrl(cItem['url']) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) urlSupport = self.up.checkHostSupport(uri) if 1 == urlSupport: retTab = self.up.getVideoLinkExt(uri) videoUrls.extend(retTab) elif 0 == urlSupport and self._uriIsValid(uri): if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': uri}) return videoUrls
def getLinksForVideo(self, cItem): url = cItem['url'] url2 = cItem['url2'] md = cItem['md'] if md == 'elo': self.susn('2', '11', 'm4_elo') videoUrls = [] turl = self.kvlva(url) if len(turl) == 0: turl = self.kvlva(url2) uri = urlparser.decorateParamsFromUrl(turl) protocol = uri.meta.get('iptv_proto', '') if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': uri}) return videoUrls
def ParseM3u(data): printDBG('ParseM3u') list = [] data = data.replace("\r", "\n").replace('\n\n', '\n').split('\n') printDBG(">>>>>>>>>>>>> data0[%s]" % data[0]) if '#EXTM3U' not in data[0]: return list params = {'title': '', 'length': '', 'uri': ''} for line in data: line = line.strip() printDBG(line) if line.startswith('#EXTINF:'): try: length, title = line.split('#EXTINF:')[1].split(',', 1) params = {'title': title, 'length': length, 'uri': ''} except Exception: printExc() params = {'title': '', 'length': '', 'uri': ''} else: if '' != params['title']: line = line.replace('rtmp://$OPT:rtmp-raw=', '') cTitle = re.sub('\[[^\]]*?\]', '', params['title']) if len(cTitle): params['title'] = cTitle params['uri'] = urlparser.decorateParamsFromUrl(line) list.append(params) params = {'title': '', 'length': '', 'uri': ''} return list
def getLinksForVideo(self, cItem): url = cItem['url'] printDBG("MindigTVHU.getLinksForVideo url[%s]" % url) videoUrls = [] self.tryTologin() try: if url[:1] == "D": if not url.endswith(".m3u"): videoUrls.append({'name': 'direct link', 'url': url[1:]}) return videoUrls sts, data = self.cm.getPage(url[1:], self.mindigiParams) if not sts: return videoUrls data = data.replace("\r\n", "\n").split("\n") for i in data: if not i.startswith("http"): continue if i.endswith('.mp3'): videoUrls.append({'name': "mp3", 'url': i}) if i.endswith('.aac'): videoUrls.append({'name': "aac", 'url': i}) return videoUrls link = cItem.get("link") expires = cItem.get("expires", 0) if not link or expires < time.time(): cItem.pop("link", None) cItem.pop("expires", None) if url[:1] == "M": sts, data = self.cm.getPage( self.MINDIG_MEDIA_URL.format(url[1:]), self.mindigiParams) if not sts: return videoUrls data = json_loads(data) link = data["url"] elif url[:1] == "H": sts, link = self.cm.getPage( self.HBBTV_MEDIA_URL.format(url[1:]), self.hbbtvParams) if not sts: return videoUrls else: return videoUrls expires = int(time.time()) + 21600 cItem["link"] = link cItem["expires"] = expires uri = urlparser.decorateParamsFromUrl(link) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': link}) except Exception(): printExc() return videoUrls
def ParseM3u(data): printDBG('ParseM3u') list = [] data = data.replace("\r", "\n").replace('\n\n', '\n').split('\n') printDBG("ParseM3u: data0[%s]" % data[0]) if '#EXT' not in data[0]: return list params = {'title': '', 'length': '', 'uri': ''} for line in data: line = line.strip() printDBG(line) if line.startswith('#EXTINF:'): tmp = line[8:].split(',', 1) params = { 'f_type': 'inf', 'title': tmp[-1].strip(), 'length': '', 'uri': '' } params.update(GetM3uAttribs(tmp[0], True)) elif line.startswith('#EXTIMPORT:'): tmp = line[11:].split(',', 1) params = { 'f_type': 'import', 'title': tmp[-1].strip(), 'length': '', 'uri': '' } params.update(GetM3uAttribs(tmp[0], True)) elif line.startswith('#EXTGRP:'): params['group-title'] = line[8:].strip() elif line.startswith('#EXTVLCOPT:'): tmp = line[11:].split(',') for it in tmp: it = it.split('=') if len(it) != 2: continue it[0] = it[0].lower() # key for m in [("program", 'program-id'), ('http-user-agent', 'user_agent')]: if it[0] == m[0]: params[m[1]] = it[1] elif not line.startswith('#'): if '' != params['title']: line = line.replace('rtmp://$OPT:rtmp-raw=', '') cTitle = re.sub('\[[^\]]*?\]', '', params['title']) if len(cTitle): params['title'] = cTitle params['uri'] = urlparser.decorateParamsFromUrl(line) list.append(params) params = {'title': '', 'length': '', 'uri': ''} return list
def getLinksForVideo(self, cItem): url = cItem['url'] printDBG("MyTvTelenorHU.getLinksForVideo url[%s]" % url) videoUrls = [] try: link = cItem.get("link") expires = cItem.get("expires", 0) if not link or expires < time.time(): cItem.pop("link", None) cItem.pop("expires", None) med = cItem.get("med") if not med: sts, data = self.cm.getPage( self.USERCONTENTS_URL.format(url, self.token), self.apiParams) if not sts: return videoUrls data = json_loads(data) meds = data["Content"][0]["PlaybackRights"] for i in meds: if i["StreamingType"] != "HLS": continue if not med and i["Quality"] == "SD" or i[ "Quality"] == "HD": med = i["Pid"] if not med: return videoUrls cItem["med"] = med sts, data = self.cm.getPage( self.MEDIA_URL.format(med, self.token), self.apiParams) if not sts: return videoUrls data = json_loads(data) link = data["Content"]["Url"] expires = int(time.time()) + 21600 cItem["link"] = link cItem["expires"] = expires uri = urlparser.decorateParamsFromUrl(link) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': uri}) except Exception(): printExc() return videoUrls
def getLinksForVideo(self, Index = 0, selItem = None): listLen = len(self.host.currList) if listLen < Index and listLen > 0: printDBG('ERROR getLinksForVideo - current list is to short len: %d, Index: %d' % (listLen, Index)) return RetHost(RetHost.ERROR, value=[]) if self.host.currList[Index]['type'] != 'video': printDBG('ERROR getLinksForVideo - current item has wrong type') return RetHost(RetHost.ERROR, value=[]) retlist = [] uri = self.host.currList[Index].get('url', '') if not self._isPicture(uri): urlList = self.host.getLinksForVideo(self.host.currList[Index]) for item in urlList: retlist.append(CUrlItem(item['name'], item['url'], 0)) else: retlist.append(CUrlItem('picture link', urlparser.decorateParamsFromUrl(uri, True), 0)) return RetHost(RetHost.OK, value=retlist)
def getLinksForVideo(self, Index = 0, selItem = None): listLen = len(self.host.currList) if listLen < Index and listLen > 0: printDBG( "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (listLen, Index) ) return RetHost(RetHost.ERROR, value = []) if self.host.currList[Index]["type"] != 'video': printDBG( "ERROR getLinksForVideo - current item has wrong type" ) return RetHost(RetHost.ERROR, value = []) retlist = [] uri = self.host.currList[Index].get('url', '') if not self._isPicture(uri): urlList = self.host.getLinksForVideo(self.host.currList[Index]) for item in urlList: retlist.append(CUrlItem(item["name"], item["url"], 0)) else: retlist.append(CUrlItem('picture link', urlparser.decorateParamsFromUrl(uri, True), 0)) return RetHost(RetHost.OK, value = retlist)
def getLinksForVideo(self, cItem): printDBG("Filmpapa.getLinksForVideo") sts, data = self.getPage(cItem['url']) if not sts: return url = self.cm.ph.getDataBeetwenMarkers( data, '<div id="cn-content" class="autosize-container"><p><iframe width="560" height="315" src="', '" frameborder="0" allow="autoplay" allowfullscreen></iframe></p>', False)[1] if not url: url = self.cm.ph.getDataBeetwenMarkers( data, ' preload="metadata" controls="controls"><source type="video/mp4" src="', '" /><a href="', False)[1] if "https:" not in url: url = "https:" + url videoUrls = [] uri = urlparser.decorateParamsFromUrl(url) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) urlSupport = self.up.checkHostSupport(uri) if 1 == urlSupport: retTab = self.up.getVideoLinkExt(uri) videoUrls.extend(retTab) elif 0 == urlSupport and self._uriIsValid(uri): if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': uri}) return videoUrls
def getLinksForVideo(self, cItem): printDBG("Urllist.getLinksForVideo url[%s]" % cItem['url']) videoUrls = [] uri, params = DMHelper.getDownloaderParamFromUrl(cItem['url']) printDBG(params) uri = urlparser.decorateUrl(uri, params) uri = urlparser.decorateParamsFromUrl(uri) urlSupport = self.up.checkHostSupport( uri ) if 1 == urlSupport: retTab = self.up.getVideoLinkExt( uri ) videoUrls.extend(retTab) elif 0 == urlSupport and self._uriIsValid(uri): if uri.split('?')[0].endswith('.m3u8'): retTab = getDirectM3U8Playlist(uri) videoUrls.extend(retTab) elif uri.split('?')[0].endswith('.f4m'): retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) else: videoUrls.append({'name':'direct link', 'url':uri}) return videoUrls
def getLinksForVideo(self, cItem): printDBG("FilmVilag.getLinksForVideo") if "https://www.onlinefilmvilag2.eu" in cItem['url']: sts, data = self.getPage(cItem['url']) if not sts: return url = self.cm.ph.getDataBeetwenMarkers(data,'height="315" src="','" width', False) [1] if "https:" not in url: url = "https:" + url else: url = cItem['url'] if "https:" not in url: url = "https:" + url videoUrls = [] uri = urlparser.decorateParamsFromUrl(url) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) urlSupport = self.up.checkHostSupport( uri ) if 1 == urlSupport: retTab = self.up.getVideoLinkExt( uri ) videoUrls.extend(retTab) elif 0 == urlSupport and self._uriIsValid(uri): if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name':'direct link', 'url':uri}) return videoUrls
def getLinksForVideo(self, cItem): printDBG("Dmdamedia.getLinksForVideo") sts, data = self.getPage(cItem['url']) if not sts: return share = self.cm.ph.getDataBeetwenMarkers(data, '<div class="beagyazas">', '" FRAMEBORDER', False)[1] share = share.replace('<iframe src="', '') if share != '': if 'https:' not in share: share = 'https:' + share else: share = self.cm.ph.getDataBeetwenMarkers( data, '<div class="beagyazas">', '" allowfullscreen', False)[1] share = share.replace('<iframe width="640" height="360" src="', '') if share != '': if 'https:' not in share: share = 'https:' + share else: share = self.cm.ph.getDataBeetwenMarkers( data, '<div class="beagyazas">', '" scrolling=', False)[1] share = share.replace('<iframe src="', '') if share != '': if 'https:' not in share: share = 'https:' + share else: share = self.cm.ph.getDataBeetwenMarkers( data, '<div class="filmbeagyazas">', '" FRAMEBORDER', False)[1] share = share.replace('<iframe src="', '') if share != '': if 'https:' not in share: share = 'https:' + share else: share = self.cm.ph.getDataBeetwenMarkers( data, '<div class="filmbeagyazas">', '" allowfullscreen', False)[1] share = share.replace( '<iframe width="640" height="360" src="', '') if share != '': if 'https:' not in share: share = 'https:' + share else: share = self.cm.ph.getDataBeetwenMarkers( data, '<div class="filmbeagyazas">', '" scrolling=', False)[1] share = share.replace('<iframe src="', '') if 'https:' not in share: share = 'https:' + share share = " ".join(share.split()) printDBG(share) share = share.replace(' ', '') printDBG("Dmdamedia.getLinksForVideo url[%s]" % share) videoUrls = [] uri = urlparser.decorateParamsFromUrl(share) protocol = uri.meta.get('iptv_proto', '') printDBG("PROTOCOL [%s] " % protocol) urlSupport = self.up.checkHostSupport(uri) if 1 == urlSupport: retTab = self.up.getVideoLinkExt(uri) videoUrls.extend(retTab) elif 0 == urlSupport and self._uriIsValid(uri): if protocol == 'm3u8': retTab = getDirectM3U8Playlist(uri, checkExt=False, checkContent=True) videoUrls.extend(retTab) elif protocol == 'f4m': retTab = getF4MLinksWithMeta(uri) videoUrls.extend(retTab) elif protocol == 'mpd': retTab = getMPDLinksWithMeta(uri, False) videoUrls.extend(retTab) else: videoUrls.append({'name': 'direct link', 'url': uri}) return videoUrls