def drawSplive(page): mode = 4 jsonChannels = Spliveappcom.getChannels(page) image = icon for item in jsonChannels: try: logger.debug("trying splive item...") #title = urllib.unquote_plus(item["title"].decode('iso-8859-1', 'ignore')) title = item["title"] link = item["link"] referer = "splive" if item.has_key("permaLink"): mode = 111 if item.has_key("referer"): referer = item["referer"] logger.info("referer is: " + referer) if item.has_key("thumbnail"): image = item["thumbnail"] logger.info("detected img: " + image) else: image = icon add_dir(title, link, mode, image, referer, link) except: logger.error("Something goes wrong with SPLIVEAPP drawer") pass
def get_main_dirs(): ##CONSTANTS PARTS## MAIN_URL = XBMCUtils.getSettingFromContext(sys.argv[1], "remote_repository") BROWSE_CHANNELS = "browse_channels" ICON = XBMCUtils.getAddonFilePath('icon.png') #draw welcome menu add_dir(XBMCUtils.getString(10001), MAIN_URL, 1, ICON, '', 0) add_dir(XBMCUtils.getString(10010), BROWSE_CHANNELS, 3, '', ICON, 0) try: from window.ImageWindow import windowImage # teletext window library add_dir(name=XBMCUtils.getString(10012), url='teletext', mode=4, provider='teletext', page=0, thumbnailImage="", iconimage=ICON) except: logger.info("No PIL module installed (needs Pillow 3.4.2 or less)") pass add_dir(XBMCUtils.getString(10014), 'paidonline', 3, "", 'paidonline', 0) add_dir(XBMCUtils.getString(10015), 'programsonline', 3, "", 'programsonline', 0) try: if updater.isUpdatable(): add_dir(XBMCUtils.getString(10011), '', 0, ICON, 0) except: logger.error("Couldn't add update option: probably server is down!") pass
def getChannels(page='0'): x = [] if str(page) == '0': page = Youtube.MAIN_URL + "/" html = Youtube.getContentFromUrl(page, "", Youtube.cookie, "") logger.debug("html: " + html) jsonScript = Decoder.extract('ytInitialGuideData = ', ';', html) x = Youtube.extractMainChannelsJSON(jsonScript) element = {} element["title"] = XBMCUtils.getString(11018) element["page"] = 'search' x.append(element) elif '/channel/' in page or '/trending' in page: headers = Youtube.buildHeaders() response = Youtube.getContentFromUrl(url=str(page + "?pbj=1"), headers=headers, launchLocation=True) try: jsonResponse = json.loads(response) logger.debug("parsed json from '" + page + "', continue...") logger.debug("json is: " + response) try: logger.debug("using way 1...") x = Youtube.extractVideosFromJSON( jsonResponse[1]["response"]) except: logger.debug("fails way 1, using way 2...") x = Youtube.extractVideosFromSpecialChannelJSON( jsonResponse[1]["response"]) pass except: logger.error("Could not parse response: " + str(response)) pass elif str(page) == 'search': keyboard = XBMCUtils.getKeyboard() keyboard.doModal() text = "" if (keyboard.isConfirmed()): text = keyboard.getText() text = urllib.quote_plus(text) headers = Youtube.buildHeaders() response = Youtube.getContentFromUrl( url=str(Youtube.SEARCH_URL + text + "?pbj=1"), headers=headers) try: jsonResponse = json.loads(response) logger.debug("parsed search json with text: '" + page + "', continue...") x = Youtube.extractVideosFromSpecialChannelJSON( jsonResponse[1]["response"]) except: logger.error("Could not parse response: " + str(response)) logger.debug("finished search logic!") else: element = Youtube.extractTargetVideoJSON(page) x.append(element) return x
def getChannels(page): x = [] if str(page) == '0': try: page=Arenavisionin.MAIN_URL+"guide" html = Arenavisionin.getContentFromUrl(page,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) #guideUrl = Decoder.rExtract('"','">EVENTS GUIDE</a></li>',html) #html = Arenavisionin.getContentFromUrl(page+guideUrl,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) except: page = Arenavisionin.MAIN_URL_RU+"guide" html = Arenavisionin.getContentFromUrl(page, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL_RU) #guideUrl = Decoder.rExtract('"', '">EVENTS GUIDE</a></li>', html) #html = Arenavisionin.getContentFromUrl(page+guideUrl, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL_RU) pass html = Decoder.extract('<table align="center" cellspacing="1" class="auto-style1" style="width: 100%; float: left"><tr><th class="auto-style4" style="width: 190px; height: 39px"><strong>DAY</strong></th>',"</tr></table></div></div></div>",html) x = Arenavisionin.extractElements(html) else: if page.find("-")>-1: #put a context menu and the user should decice, if not use the first one (default action) dialog = XBMCUtils.getDialog() cmenu = [] for contextItem in page.split("-"): #if len(contextItem)>0: cmenu.append(contextItem) result = dialog.select(XBMCUtils.getString(11016), cmenu) #choose logger.debug("result was: "+str(result)) if result == None or result==-1: target = page[:page.find("-")] page = target else: logger.debug("has choosed "+str(result)+": "+cmenu[result]) page = (cmenu[result]) html = Arenavisionin.getContentFromUrl(Arenavisionin.MAIN_URL, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL) link = Decoder.rExtract("<a href=\"","title=\"\">ArenaVision "+page+"</a>",html) logger.debug("html is: "+html) link = link[:link.find('"')] logger.debug("provisional link is: "+link) else: if "av" not in page: page = "av"+page link = "http://www.arenavision.us/"+page try: html = Arenavisionin.getContentFromUrl(link,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) logger.debug("second html is: "+html) except: logger.error("sonething goes wrong with link: "+link) pass if html.find("acestream://")>-1: link2 = Decoder.extractWithRegex("acestream://",'"',html).replace('"',"") else: link2 = Decoder.extractWithRegex("sop://",'"',html).replace('"',"") element = {} element["title"] = page element["link"] = link2 x.append(element) return x
def drawHdfulltv(page): mode = 4 #continue browsing jsonChannels = HdfullTv.getChannels(page) for itemFirst in jsonChannels: title = "" if itemFirst.has_key("permalink"): if itemFirst.has_key("show"): #serie link = "https://hdfull.me/serie/" + itemFirst[ "permalink"] + "/temporada-" + itemFirst[ "season"] + "/episodio-" + itemFirst["episode"] title = itemFirst["show"]["title"] if type(title) == type(dict()): if title.has_key("es"): title = title["es"] else: title = "" if len(title) == 0 and itemFirst["title"].has_key("en"): title = itemFirst["title"]["en"] #put the season and the chapter chapter = int(itemFirst["episode"]) if chapter < 10: chapterString = "0" + str(chapter) else: chapterString = str(chapter) title = title + " " + itemFirst["season"] + "x" + chapterString else: if (itemFirst["permalink"].find("http://") > -1): link = itemFirst["permalink"] elif itemFirst["permalink"].find("http") > -1: link = itemFirst["permalink"] else: link = "https://hdfull.me/" + itemFirst["permalink"] title = itemFirst["title"] try: if type(title) == type(dict()): if title.has_key("es"): title = title["es"] else: title = "" if len(title) == 0 and itemFirst["title"].has_key( "en"): title = itemFirst["title"]["en"] except: logger.error("title is not dic, fails!!" + str(title)) pass if itemFirst.has_key("thumbnail"): image = itemFirst["thumbnail"] if image.find("http://") < 0: image = "https://hdfull.me/tthumb/130x190/" + image else: image = icon if itemFirst.has_key("finalLink"): mode = 100 #open link from provider title = itemFirst["title"] link = itemFirst["link"] image = "" add_dir(title, link, mode, image, "hdfulltv", link)
def get_params(): param = [] paramstring = sys.argv[2] if len(paramstring) >= 2: params = sys.argv[2] try: #now extract expected params, it has been changed because some params could be links #with other params and the previews method (split with '?' expr. doesn't work in some cases) logger.debug("filling params array with brute params...") mode = params[params.find("mode=") + len("mode="):] logger.debug("brute mode: " + mode) if mode.find("&") > -1: mode = mode[:mode.find("&")] url = params[params.find("url=") + len("url="):] logger.debug("brute url: " + url) if url.find("&mode") > -1: url = url[:url.find("&mode")] elif url.find("&page") > -1: url = url[:url.find("&page")] elif url.find("&") > -1: url = url[:url.find("&")] page = params[params.find("page=") + len("page="):] logger.debug("brute page: " + page) if page.find("&provider") > -1: page = page[:page.find("&provider")] elif page.find("&") > -1: page = page[:page.find("&")] provider = params[params.find("provider=") + len("provider="):] logger.debug("brute provider: " + provider) if provider.find("&") > -1: provider = provider[:provider.find("&")] #finally put in param array logger.debug("done, filling params dic...") param = {} param["mode"] = mode param["url"] = url param["page"] = page param["provider"] = provider logger.debug("done params built: " + str(len(param))) except Exception as e: logger.error("ERROR: using old method to extract params..." + str(e)) #old method cleanedparams = params.replace('?', '') if (params[len(params) - 1] == '/'): params = params[0:len(params) - 2] pairsofparams = cleanedparams.split('&') param = {} for i in range(len(pairsofparams)): splitparams = {} splitparams = pairsofparams[i].split('=') if (len(splitparams)) == 2: param[splitparams[0]] = splitparams[1] logger.info("param: " + splitparams[0] + " with value: " + splitparams[1]) return param
def extractElements(table,decode=False): x = [] i = 0 permaLink = False if table.find("@ /lista")>-1: splitter = "@ /lista" elif table.find("@ /channel")>-1: splitter = "@ /channel" permaLink = True elif table.find("@ /movie")>-1: splitter = "@ /movie" permaLink = True for value in table.split(splitter): element = {} title = "" link = "" referer = "" if value.find(" title ")>-1: title = Decoder.extract(" title \"","\"",value) elif value.find(" name")>-1: title = Decoder.extract(" name \"","\"",value) if value.find(" url \"")>-1: link = Decoder.extract(" url \"","\"",value) elif value.find(" url_servidor \"")>-1: link = Decoder.extract(" url_servidor \"","\"",value) element["title"] = title img = "" if value.find(" image \"")>-1: img = Decoder.extract(" image \"","\"",value) elif value.find(" image_url ")>-1: img = Decoder.extract(" image_url \"","\"",value) if decode and img.find("http")==-1: try: img = Spliveappcom.decrypt(img) element["thumbnail"] = img except: logger.error("Could not be decoded img content.") pass elif img!="": element["thumbnail"] = img if link.find("pastebin.com"): link = link.replace(".com/",".com/raw/") element["link"] = link if value.find("referer \"")>-1: referer = Decoder.extract("referer \"","\"",value) if referer!="0": element["referer"] = referer if permaLink: element["permaLink"] = True logger.debug("append: "+title+", link: "+element["link"]) if title!='' and link!='': x.append(element) i+=1 return x
def httpProxyUpdater(): masterPatchUrl = "https://github.com/harddevelop/httpproxy-service/archive/master.zip" try: updater.install(masterPatchUrl, "org.harddevelop.kodi.proxy", "org.harddevelop.kodi.proxy") XBMCUtils.getOkDialog(XBMCUtils.getString(30060), XBMCUtils.getString(30060)) logger.debug("patch installed!") except: logger.error("Patch not installed, something wrong happened!") pass
def decrypt(encrypted): decrypted = encrypted try: logger.debug("Encrypted content is: "+encrypted) if not ONLINE: decrypted = PBEWithMD5AndDES.decrypt(encrypted, Spliveappcom.PASSWORD) elif len(encrypted)>0 and encrypted.find("http://")==-1: decrypted = Downloader.getContentFromUrl(Spliveappcom.DECODER_URL+'?data='+encrypted+"&key="+Spliveappcom.PASSWORD+"&iterations=1000") logger.debug("Decrypted content is: "+decrypted) except: logger.error("Could not be unencrypted: "+encrypted) pass return decrypted
def getChannels(page): x = [] if page == '0': url = Reuters.LAST_NEWS_RSS + str(time.time() * 1000) logger.debug("news rss url is: " + url) bruteResult = Reuters.getContentFromUrl(url=url, launchLocation=False, ajax=True) logger.debug("brute ajax response: " + bruteResult) results = json.loads(bruteResult) i = 0 for result in results["headlines"]: if i > 0: element = {} img = result["mainPicUrl"] link = Reuters.MAIN_URL + result["url"] title = result["formattedDate"] + " - " + result["headline"] logger.debug("appending result: " + title + ", url: " + link + ", img: " + img) element["title"] = title element["link"] = link element["thumbnail"] = img x.append(element) i += 1 else: html = Reuters.getContentFromUrl(url=page) startRegex = '<span id="article-text">' if '<span id="article-text">' in html: startRegex = '<span id="article-text">' else: startRegex = '<span id="articleText">' body = Decoder.extract(startRegex, '<div class="linebreak"></div>', html) body = Decoder.removeHTML(body) if '|' in body: body = body[body.find('|') + 1:] try: lowerCaseIndex = int(re.search("[a-z]", body).start()) body = body[:lowerCaseIndex - 1] + "\n" + body[lowerCaseIndex - 1:] except: logger.error( "No break for city was done. Something goes wrong") pass element = {} element["link"] = page element["title"] = body element["thumbnail"] = '' x.append(element) return x
def quasarUpdater(): if XBMCUtils.getDialogYesNo(XBMCUtils.getString(30052), XBMCUtils.getString(30052)): quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/archive/master.zip" if XBMCUtils.isWindowsPlatform(): logger.debug("Detected Windows system...") if "x64" in platform.machine(): quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.windows_x64.zip" else: quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.windows_x86.zip" elif XBMCUtils.isAndroidPlatform(): logger.debug("Detected Android system...") if os.uname()[4].startswith("arm"): logger.debug("android system...") quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.android_arm.zip" else: logger.debug("Androidx86 system...") quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.android_x86.zip" elif XBMCUtils.isRaspberryPlatform(): logger.debug("raspberry system...") if "armv7" in platform.machine(): logger.debug("raspberry pi 2!") quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.linux_armv7.zip" elif "armv6" in platform.machine(): logger.debug("raspberry pi 1!") quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.linux_arm.zip" else: logger.debug("raspberry pi 3!") quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.linux_arm64.zip" elif XBMCUtils.isLinuxPlatform(): if "x64" in platform.machine(): quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.linux_x64.zip" else: quasarUrl = "https://github.com/scakemyer/plugin.video.quasar/releases/download/v0.9.34/plugin.video.quasar-0.9.34.linux_x86.zip" else: logger.info( "no detected platform, using default (could be a osx?)") try: updater.install(quasarUrl, "plugin.video.quasar", "plugin.video.quasar") logger.debug("addon installed!") except: logger.error("Addon not installed, something wrong happened!") pass XBMCUtils.getOkDialog(XBMCUtils.getString(30051), XBMCUtils.getString(30051)) logger.debug("launch done!")
def getChannels(page): x = [] if page == '0': url = CNN.LAST_NEWS_RSS logger.debug("news rss url is: "+url) bruteResult = CNN.getContentFromUrl(url=url,launchLocation=True,ajax=False) logger.debug("brute response: "+bruteResult) lists = common.parseDOM(bruteResult, "item") if len(lists) > 0: logger.info("counted: " + str(len(lists))) for item in lists: name = common.parseDOM(item, "title")[0].encode("utf-8") value = common.parseDOM(item, "guid")[0].encode("utf-8") logger.info("Added: " + name + ", url: " + value) element = {} element["title"] = name.replace('<![CDATA[','').replace("]]>","") element["link"] = value.replace("//www.cnn.com/","//edition.cnn.com/") try: img = common.parseDOM(item, "media:content", ret="url")[0].encode("utf-8") element["thumbnail"] = img except: logger.debug("Could not be extracted any img. :'(") x.append(element) else: html = CNN.getContentFromUrl(url=page,launchLocation=True,referer=CNN.MAIN_URL) startRegex = '<div class="el__leafmedia el__leafmedia--sourced-paragraph">' body = Decoder.extract(startRegex,'</div><p class="zn-body__paragraph zn-body__footer">',html) logger.debug("removing html: "+body) body = Decoder.removeHTML(body) logger.debug("html has removed from body!") if '|' in body: body = body[body.find('|')+1:] try: lowerCaseIndex = int(re.search("[a-z]", body).start()) body = body[:lowerCaseIndex-1]+"\n"+body[lowerCaseIndex-1:] except: logger.error("No break for city was done. Something goes wrong") pass element = {} element["link"] = page element["title"] = body element["thumbnail"] = '' x.append(element) return x
def plexusUpdater(): if XBMCUtils.getDialogYesNo(XBMCUtils.getString(30050), XBMCUtils.getString(30050)): try: # url = "http://repo.adryanlist.org/program.plexus-0.1.4.zip" url = "https://github.com/AlexMorales85/program.plexus/archive/1.2.2.zip" # better and updated with an acestream fixed client for raspberry platforms updater.install(url, "program.plexus", "program.plexus") logger.debug("addon installed!") # try with request dependency updater.install( "https://github.com/beenje/script.module.requests/archive/gotham.zip", "script.module.requests", "script.module.requests") logger.debug("dependency installed, finished!") except: logger.error("Addon not installed, something wrong happened!") pass XBMCUtils.getOkDialog(XBMCUtils.getString(30051), XBMCUtils.getString(30051)) logger.debug("launch done!")
def extractTargetVideoJSON(page): title = '' link = '' thumbnail = '' headers = Youtube.buildHeaders() response = Youtube.getContentFromUrl(url=str(page + "?pbj=1"), headers=headers) logger.debug("response is: " + response) try: responseJ = Decoder.extract('ytplayer.config = ', '};', response) + "}" logger.debug("json extracted is: " + responseJ) jsonResponse = json.loads(responseJ) logger.debug("json loaded") bruteVideoInfo = jsonResponse["args"] logger.debug("obtained brute video info...") title = bruteVideoInfo["title"] url = bruteVideoInfo["adaptive_fmts"] url = Decoder.extract('url=', ",", url) url = urllib.unquote(url) #url = url[:-1] thumbnail = bruteVideoInfo["thumbnail_url"] logger.debug("extracted final url: " + url) ''' content = Youtube.getContentFromUrl(url=url) logger.debug("content extracted: "+content) if '<BaseURL>' in content: link = Decoder.rExtract('<BaseURL>','</BaseURL>',content) else: logger.info("No video url found :(") pass ''' logger.debug("parsed video info") except: logger.error("error parsing video info") pass element = {} element["title"] = title element["link"] = link element["thumbnail"] = thumbnail element["finalLink"] = True return element
def getSection(url): x = [] url = url.replace("&","&") html = RTVEAlaCarta.getContentFromUrl(url=url,referer=RTVEAlaCarta.A_LA_CARTA) content = Decoder.rExtract('</ul><div class="ContentTabla">','<div class="pagbox mark">',html) if ' class="anterior">' in html: logger.debug("'anterior' FOUND!") if '" class="anterior">' not in html: html2 = Decoder.extract(' class="anterior">', "</li>", html) else: html2 = Decoder.extract('" class="anterior">', "</li>", html) link = Decoder.extract('href="', '"', html2) if "<span>" in html2: title = Decoder.extract('<span>', '</span>', html2) else: #title is in other part, so it's needed more html html2 = Decoder.rExtract("<li",'" class="anterior">', html) title = Decoder.extract('title="','"',html2) element = {} if RTVEAlaCarta.MAIN_URL not in link: link = RTVEAlaCarta.MAIN_URL + link element["link"] = link element["title"] = title x.append(element) if '<!--EMPIEZA TOOL-TIP-->' in content: for line in content.split('<!--EMPIEZA TOOL-TIP-->'): logger.debug("html line is: "+line) title = Decoder.extract(' title="Ver programa seleccionado">','<',line) link = Decoder.rExtract('<a href=',title+'</a>',line) link = Decoder.extract('"','"',link) logger.debug("new link is: "+link) element = {} element["title"] = title if RTVEAlaCarta.MAIN_URL not in link: link = RTVEAlaCarta.MAIN_URL+link logger.debug("title: "+title+", url: "+link) element["link"] = link x.append(element) elif '</li><li class="' in content: for line in content.split('</li><li class="'): logger.debug("html line is: " + line) link = Decoder.extract('<a href="', '"', line) title = Decoder.extract('/">', '</a>', line).replace(" "," ").replace("<em>","").replace("</em>","") element = {} element["title"] = title if RTVEAlaCarta.MAIN_URL not in link: link = RTVEAlaCarta.MAIN_URL + link logger.debug("title: " + title + ", url: " + link) element["link"] = link element["finalLink"] = True if "</span>" not in title: x.append(element) elif '</li><li class="' in html: for line in html.split('</li><li class="'): logger.debug("html line is: " + line) link = Decoder.extract('<a href="', '"', line) title = Decoder.extract('/">', '</a>', line).replace(" ", " ").replace("<em>", "").replace("</em>", "") element = {} element["title"] = title if RTVEAlaCarta.MAIN_URL not in link: link = RTVEAlaCarta.MAIN_URL + link logger.debug("title: " + title + ", url: " + link) element["link"] = link element["finalLink"] = True if "</span>" not in title: x.append(element) if ' class="siguiente">' in html: logger.debug("'siguiente' FOUND!") if '" class="siguiente">' not in html: html2 = Decoder.extract(' class="siguiente">', "</li>", html) else: html2 = Decoder.extract('" class="siguiente">', "</li>", html) link = Decoder.extract('href="', '"', html2) if "<span>" in html2: title = Decoder.extract('<span>', '</span>', html2) else: #title is in other part, so it's needed more html html2 = Decoder.rExtract("<li", '" class="siguiente">', html) title = Decoder.extract('title="','"',html2) element = {} if RTVEAlaCarta.MAIN_URL not in link: link = RTVEAlaCarta.MAIN_URL + link element["link"] = link element["title"] = title x.append(element) if len(x) == 0: #json api pageCode = Decoder.extract('/alacarta/interno/contenttable.shtml?ctx=','&',html) jsonPage = "http://www.rtve.es/api/programas/%s/videos.json?page=1&size=60" % pageCode jsonContent = RTVEAlaCarta.getContentFromUrl(url=jsonPage) try: jsonObject = json.loads(jsonContent) logger.debug("loaded json") for item in jsonObject["page"]["items"]: logger.debug("item looping...") url = item["htmlUrl"] title = item["longTitle"] element = {} element["link"] = link element["title"] = title try: element["thumbnail"] = item["imageSEO"] except: logger.error("No imageSEO found!") pass element["finalLink"] = True x.append(element) except: logger.error("Could not parse JSON from ALACARTA alternative way: "+jsonPage) return x
def decodeLink(link, referer=''): originalLink = link patternList = [ '.torrent', 'acestream:', 'magnet:', 'sop:', 'mobdro.me' ] if not any(regex in link for regex in patternList): logger.debug("trying alfa engine...") try: logger.debug("first try...") link = Decoder.decodeWithImportedEngine(targetUrl=link) logger.debug("done, url at this moment is %s " % link) except Exception as e: logger.info( "Something goes wrong, probably there are not engines available, retrying... %s " % str(e)) try: Decoder.importEngine( engine="alfaengine", url= "https://github.com/alfa-addon/addon/archive/master.zip", targetPath="/addon-master/plugin.video.alfa/", deletePath="addon-master") logger.debug("retry in course...") link = Decoder.decodeWithImportedEngine(link) except Exception as e2: logger.error("FATAL: Something goes wrong: %s" % str(e2)) pass pass if originalLink == link or len(link) == 0: #use second one logger.debug("trying youtube-dl library...") try: link = Decoder.decodeWithYoutubeEngine(url=link) except Exception as e: logger.info( "Something goes wrong, probably there are not engines available, retrying... %s " % str(e)) Decoder.importEngine( engine="youtubedl", url= "https://github.com/rg3/youtube-dl/archive/master.zip", targetPath="/youtube-dl-master/youtube_dl/", deletePath="youtube-dl-master") Decoder.applyFix(fileFix="/youtubedl/extractor/common.py", removeFix='and sys.stderr.isatty()') Decoder.applyFix(fileFix="/youtubedl/YoutubeDL.py", removeFix='and self._err_file.isatty()') Decoder.applyFix(fileFix="/youtubedl/downloader/common.py", removeFix='sys.stderr.isatty()', replaced='False') logger.debug("retry in course...") try: link = Decoder.decodeWithYoutubeEngine(url=link) except Exception as e2: logger.error("Something goes wrong: %s" % str(e2)) pass pass return link
from providers.rtve import RTVE from providers.pepecine import Pepecine from providers.cnn import CNN from providers.elmundo import ElMundo from providers.elpaises import ElPais from providers.streamingsport365 import StreamingSports365 from providers.clan import Clan from providers.rtvealacarta import RTVEAlaCarta from providers.mejortorrent import MejorTorrent from providers.tumejortorrent import TuMejorTorrent from providers.acesoplistingin import Acesoplistingin try: from providers.spliveappcom import Spliveappcom except: logger.error( "Crypto-problems detected, probably you need a better platform") pass from window.DefaultWindow import DefaultWindow #papernews window library try: from window.ImageWindow import windowImage #teletext window library except: logger.info( "No module named PIL was found in the system, hidding teletext library." ) pass icon = XBMCUtils.getAddonFilePath('icon.png') def drawFilmon(page):
def getContentFromUrl(url,data="",cookie="",referer="",ajax=False,launchLocation=True,headers={},gzip=False): host = url[url.find("://")+len("://"):] subUrl = "" logger.info("url is: "+host) if host.find("/")>-1: host = host[0:host.find("/")] subUrl = url[url.find(host)+len(host):] if host.find(":")==-1: logger.debug("host: "+host+":80 , subUrl: "+subUrl) else: logger.debug("host: "+host+" , subUrl: "+subUrl) if headers == {}: logger.debug("building default headers...") headers = { "User-Agent": Downloader.USER_AGENT, "Accept-Language" : "en-US,en;q=0.8,es-ES;q=0.5,es;q=0.3", #"Conection" : "keep-alive", "Host":host, "DNT":"1", #"Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8", "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" } if referer!="": headers["Referer"] = referer if cookie !="": headers["Cookie"] = cookie if ajax: headers["X-Requested-With"] = "XMLHttpRequest" headers["Accept"] = "application/json, text/javascript, */*; q=0.01" if gzip: headers["Accept-Encoding"]="gzip, deflate, br" if host.find(":")==-1: if url.find("https://")>-1: h = httplib.HTTPSConnection(host+":443") logger.debug("launching https to port 443") else: h = httplib.HTTPConnection(host+":80") logger.debug("launching http to port 80") else: h = httplib.HTTPConnection(host) if data == "": logger.debug("launching GET for "+url+"...") req = urllib2.Request(url, headers=headers) try: r = urllib2.urlopen(req, timeout=Downloader.TIMEOUT) except BaseException as e: logger.error("Something went wrong with urllib :'(: "+str(e)) pass try: logger.debug("connection info: "+str(r.info())) except: logger.error("could not be converted") pass cookie = "" logger.debug("reading...") html = r.read() headers = r.info() if ('Content-Encoding' in headers.keys() and headers['Content-Encoding'] == 'gzip') or ('content-encoding' in headers.keys() and headers['content-encoding'] == 'gzip'): logger.debug("Uncompressing content...") html = StringIO.StringIO(html) gzipper = gzip.GzipFile(fileobj=html) html = gzipper.read() logger.debug("Done uncompressing content process.") logger.debug("cookies...") #update cookies for key1, value1 in sorted(r.info().items()): logger.debug("trace....."+key1) if key1.lower()=='set-cookie': value1 = value1.replace("path=/, ","") if value1.find(";")==-1: value1+=";=" logger.debug("processing cookie...: "+value1) if value1.find(";")>-1: for values in value1.split(";"): logger.debug(values) if values.find("=")>-1: key = values.split("=")[0] value = values.split("=")[1] logger.debug("key: "+key+", value="+value) if(key.find("PHPSESSID")>-1 or key.find("captcha_keystring")>-1 or key.find("__cfduid")>-1 or key.find("key")): if value.find(";")>-1: cookie+=key+"="+value[:value.find(";")] else: cookie+=key+"="+value cookie+=";" logger.debug("processed cookie: "+key+"="+value) elif key1.lower()=='location': logger.info("Location detected: using location: "+value1) location = value1 else: logger.debug("rejected cookie: "+key1+"->"+value1) if len(cookie)>1: Downloader.cookie = cookie logger.info("Cookie was updated to: "+cookie) location = "" if cookie!= '': Downloader.cookie = cookie logger.info("cookie was updated to: "+Downloader.cookie) if location != '' and launchLocation: if location=="/": location = url elif location.find("/")==0: location = "http://"+host+location logger.info("launching redirection to: "+location) html = Downloader.getContentFromUrl(location,data,Downloader.cookie,url) else: logger.debug("launching POST...") req = urllib2.Request(url, data, headers) r = urllib2.urlopen(req, timeout=Downloader.TIMEOUT) logger.debug(str(r.info())) logger.debug("reading...") html = r.read() headers = r.info() if ('Content-Encoding' in headers.keys() and headers['Content-Encoding'] == 'gzip') or ('content-encoding' in headers.keys() and headers['content-encoding'] == 'gzip'): html = StringIO.StringIO(html) gzipper = gzip.GzipFile(fileobj=html) html = gzipper.read() logger.debug("cookies...") cookie = "" #update cookies for key1, value1 in sorted(r.info().items()): logger.debug("trace....."+key1) if key1.lower()=='set-cookie': value1 = value1.replace("path=/, ","") if value1.find(";")==-1: value1+=";=" logger.debug("processing cookie...: "+value1) if value1.find(";")>-1: for values in value1.split(";"): logger.debug(values) if values.find("=")>-1: key = values.split("=")[0] value = values.split("=")[1] logger.debug("key: "+key+", value="+value) if(key.find("PHPSESSID")>-1 or key.find("captcha_keystring")>-1 or key.find("__cfduid")>-1 or key.find("key")): if value.find(";")>-1: cookie+=key+"="+value[:value.find(";")] else: cookie+=key+"="+value cookie+=";" logger.debug("processed cookie: "+key+"="+value) else: logger.debug("rejected cookie: "+key1+"->"+value1) if len(cookie)>1: Downloader.cookie = cookie logger.info("Cookie was updated to: "+cookie) return html
def __init__(self): window = xbmcgui.Window(xbmcgui.getCurrentWindowId()) window.setProperty('ShowImage', 'true') # check arg getting from settings try: idImage = str(sys.argv[1]) except: idImage = '0' window = xbmcgui.Window(xbmcgui.getCurrentWindowId()) imagePath = window.getProperty('imagePath') logger.debug("imagePath property: " + str(imagePath)) # set max height and margin to background xImageRes = 660 yImageRes = 400 yMax = 660 margin = 10 if idImage == '0': msg = "Code 0 message" elif imagePath == '': msg = "Other codes different from 0" else: try: logger.debug("trying to download image from: " + imagePath) imageName = imagePath[imagePath.rfind("/"):] localfile = ROOT_DIR + imageName headers = {} headers[ 'User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' downloadfile(url=imagePath, fileName=localfile, headers=headers) logger.debug("trying to open image in window: " + localfile) image = Image.open(localfile) logger.debug("finished: " + localfile) msg = '' except: msg = "Exception message" logger.error( "Something goes wrong trying to obtain remote image inside ImageWindow class" ) else: imageSize = image.size xImageRes = imageSize[0] yImageRes = imageSize[1] # scale if image is too big if yImageRes > yMax: scale = (xImageRes) / float(yImageRes) xImageRes = int(scale * yMax) yImageRes = yMax # set size xImagePos = ((1280 - xImageRes) / 2) yImagePos = ((720 - yImageRes) / 2) - margin xBgRes = xImageRes + (margin * 2) yBgRes = yImageRes + (margin * 4) xBgPos = xImagePos - margin yBgPos = yImagePos - margin # create window self.bg = xbmcgui.ControlImage(xBgPos, yBgPos, xBgRes, yBgRes, ROOT_DIR + '/images/bg.png') self.addControl(self.bg) if msg == '': self.image = xbmcgui.ControlImage(xImagePos, yImagePos, xImageRes, yImageRes, imagePath) self.addControl(self.image) else: self.label = xbmcgui.ControlLabel(xImagePos, yImagePos, xImageRes, yImageRes, msg, 'font13', alignment=6) self.addControl(self.label)
import json except: import simplejson as json import urllib from tvboxcore.xbmcutils import XBMCUtils from tvboxcore.decoder import Decoder from tvboxcore import jsunpack from tvboxcore import logger from tvboxcore.downloader import Downloader ONLINE = False try: from tvboxcore.cipher import PBEWithMD5AndDES except: logger.error("Detected missing pycrypt") logger.info("using online decrypter solution...") ONLINE = True pass class Spliveappcom(Downloader): MAIN_URL = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "splive_channel") DECODER_URL = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "online_pbewithmd5anddes_decoder") PASSWORD = '******' @staticmethod def getChannels(page,decode=False,group=''): x = [] if str(page) == '0' or "http" not in page:
def init(): params = get_params() url = "" mode = None page = "" provider = "" try: page = urllib.unquote_plus(params["page"]) except: pass try: url = urllib.unquote_plus(params["url"]) except: pass try: mode = int(params["mode"]) except: pass try: provider = urllib.unquote_plus(params["provider"]) except: pass logger.debug("Mode: " + str(mode)) logger.debug("URL: " + str(url)) logger.debug("page: " + str(page)) logger.debug("provider: " + str(provider)) try: if mode == None: #init get_main_dirs() elif mode == 1: #get channels getListsUrls(url) elif mode == 2: #open video in player open(url, page) elif mode == 3: browse_channels(url, page) elif mode == 4: browse_channel(url, page, provider) elif mode == 5: drawFilmonLinks(url, page) elif mode == 0: #update addonUpdater() get_main_dirs() elif mode == 97: httpProxyUpdater() elif mode == 98: quasarUpdater() elif mode == 99: plexusUpdater() elif mode == 100: #decode provider link decodeAndOpenLink(url, page) elif mode == 101: openVipgoalLink(url, page) elif mode == 102: openCineestrenosLink(url, page) elif mode == 103: openCricFreeLink(url, page) elif mode == 104: openZopTvLink(url, page) elif mode == 105: openLive9Link(url, page) elif mode == 106: openSports4uLink(url, page) elif mode == 107: openVipracingLink(url, page) elif mode == 108: openSkylineLink(url, page) elif mode == 109: openZonasportsLink(url, page) elif mode == 110: openSports365Link(url, page) elif mode == 111: openSpliveLink(url, page, provider) elif mode == 112: openMamahdLink(url, page) elif mode == 113: openShowsportsLink(url, page) elif mode == 114: openArenavisionLink(url, page) elif mode == 115: openYoutubeLink(url, page) elif mode == 116: openZonaappLink(url, page) elif mode == 117: drawFilmonLinks(url, page) elif mode == 118: openTuneInLink(url, page) elif mode == 119: openYoutvgratisLink(url, page) elif mode == 120: openYomvies(url, page) elif mode == 121: openStreamgaroo(url, page) elif mode == 122: openMobdro(url, page) elif mode == 123: openPeliculasbiz(url, page) elif mode == 124: openElitetorrentnet(url, page) elif mode == 125: openClan(url, page) elif mode == 126: openTuMejorTorrent(url, page) elif mode == 127: openMejorTorrent(url, page) except Exception as e: logger.error(XBMCUtils.getString(10009) + ", " + str(e)) XBMCUtils.getNotification("Error", XBMCUtils.getString(10009)) pass if not isAnException(url, page, provider, mode): logger.debug("End of main menu to be displayed. Params -> page: " + page + ", url: " + url + ", provider: " + provider + ", mode: " + str(mode)) XBMCUtils.setEndOfDirectory(int(sys.argv[1]))
def mainLogicExtractIframeChannel(html3, iframeUrl2): element = {} if html3.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html3, iframeUrl2) elif html3.find( '<script type="text/javascript" src="http://www.sunhd.info/channelsa.php?file=' ) > -1: element = Cineestrenostv.extractScriptSunhdinfo(html3, iframeUrl2) elif html3.find( '<script type="text/javascript" src="http://www.ponlatv.com/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptPonlatv(html3, iframeUrl2) elif html3.find("http://vercanalestv.com/tv/") > -1: #vercanalestv iframeUrl = Decoder.extractWithRegex("http://vercanalestv.com/tv/", '"', html3) logger.debug("obtained iframeUrl: " + iframeUrl) html2 = Cineestrenostv.getContentFromUrl( iframeUrl[0:len(iframeUrl) - 1], "", Cineestrenostv.cookie, "") if html2.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: element = Cineestrenostv.extractIframeChannel(html2, iframeUrl) else: logger.error("Something unexpected happened with url: " + iframeUrl) #print "ERROR: "+html2 elif html3.find( "http://www.dinostream.pw/channel.php?file=" ) > -1: #dinostream.pw has an iframe inside, so get iframe content and proccess it logger.debug("processing dinostream channel...") element = Cineestrenostv.extractScriptDinostream(html3, iframeUrl2) elif html3.find( "<script type='text/javascript' src='http://www.embeducaster.com/static/scripts/ucaster.js'></script>" ) > -1: #ucaster cases if html3.find( "<script type='text/javascript'> width=650, height=400, channel='" ) > -1: channel = Decoder.extract( "<script type='text/javascript'> width=650, height=400, channel='", "'", html3) else: channel = Decoder.extract( "<script type='text/javascript'> width=", "',", html3) channel = channel[channel.find("channel='") + len("channel='"):] logger.debug("ucaster channel: " + channel) if html3.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html3, iframeUrl2) else: ucasterUrl = 'http://www.embeducaster.com/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( ucasterUrl, "", Cineestrenostv.cookie, iframeUrl2) playerUrl = Decoder.decodeUcaster(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl logger.debug(channel + ", " + element["link"]) elif html3.find( 'http://www.mipsplayer.com/content/scripts/mipsEmbed.js' ) > -1: #before verdirectotv.com, if not is always called channel = Decoder.extract("channel='", "'", html3) mipsUrl = 'http://www.mipsplayer.com/embedplayer/' + channel + '/1/650/400' logger.debug("mips url is: " + mipsUrl) html4 = Cineestrenostv.getContentFromUrl(mipsUrl, "", Cineestrenostv.cookie, iframeUrl2) playerUrl = Decoder.decodeMipsplayer(html4, iframeUrl2) logger.debug("mipsplayer - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif 'http://09stream.com/canal' in html3: logger.debug("using 09stream logic...") scriptUrl = Decoder.extractWithRegex("http://09stream.com/canal", '"', html3).replace('"', "") html4 = Cineestrenostv.getContentFromUrl( url=scriptUrl, cookie=Cineestrenostv.cookie, referer=iframeUrl2) element = Cineestrenostv.extractIframeChannel(html4, scriptUrl) elif html3.find("http://verdirectotv.com/tv") > -1: logger.debug("proccessing level 3, cookie: " + Cineestrenostv.cookie) scriptUrl = Decoder.extractWithRegex("http://verdirectotv.com/tv", '"', html3) scriptUrl = scriptUrl[0:len(scriptUrl) - 1] html4 = Cineestrenostv.getContentFromUrl(scriptUrl, "", Cineestrenostv.cookie, iframeUrl2) #logger.debug("verdirectotv html: "+html4) if html4.find("http://www.dinostream.pw/channel.php?file=") > -1: scriptUrl2 = Decoder.extractWithRegex( "http://www.dinostream.pw/channel.php?file=", '&autostart=true"', html4) scriptUrl2 = scriptUrl2[0:len(scriptUrl2) - 1] element = Decoder.extractDinostreamPart(scriptUrl2, scriptUrl) elif html4.find( "<script type='text/javascript' src='http://www.embeducaster.com/static/scripts/ucaster.js'></script>" ) > -1: #ucaster cases channel = Decoder.extract( "<script type='text/javascript'> width=650, height=400, channel='", "'", html4) if html4.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html4, scriptUrl) else: ucasterUrl = 'http://www.embeducaster.com/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( ucasterUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeUcaster(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl logger.debug(channel + ", " + element["link"]) elif html4.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: #retry the same logic element = Cineestrenostv.extractIframeChannel( html4, iframeUrl2) elif html4.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html4, scriptUrl) elif html4.find( "<script type='text/javascript' src='http://www.liveflashplayer.net/resources/scripts/" ) > -1: channel = Decoder.extract("channel='", "'", html4) mipsUrl = 'http://www.liveflashplayer.net/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( mipsUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeLiveFlash(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif html4.find( 'http://www.mipsplayer.com/content/scripts/mipsEmbed.js' ) > -1: channel = Decoder.extract("channel='", "'", html4) mipsUrl = 'http://www.mipsplayer.com/embedplayer/' + channel + '/1/650/400' html4 = Cineestrenostv.getContentFromUrl( mipsUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeMipsplayer(html4, iframeUrl2) logger.debug("mipsplayer - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif scriptUrl != iframeUrl2: logger.debug("trying new loop with: " + scriptUrl + ", " + iframeUrl2) element = Cineestrenostv.mainLogicExtractIframeChannel( html4, scriptUrl) else: logger.debug("big data: " + html4) elif html3.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="653" height="403" src="' ) > -1: logger.debug("extracting iframe channel with referer: " + iframeUrl2) element = Cineestrenostv.extractIframeChannel(html3, iframeUrl2) elif html3.find('file: "') > -1 and html3.find( '.m3u8') > -1: #direct link, not needed any logic link = Decoder.extract('file: "', '",', html3) link = link + "|Referer=" + iframeUrl2 logger.debug("detected direct link: " + link) element["title"] = "Watching direct link" element["permalink"] = True element["link"] = link elif html3.find("http://telefivegb.com/") > -1 or html3.find( "http://verlatelegratis.net") > -1: element = Cineestrenostv.extractNewIframeChannel(html3, iframeUrl2) elif html3.find("http://tvpor-internet.com/") > -1 or html3.find( "http://www.malosolandia.com/") > -1: logger.debug("inside here!..") newUrl = "dummy url" #dummy if html3.find("http://tvpor-internet.com/") > -1: logger.debug("inside here1!..") newUrl = Decoder.extractWithRegex('http://tvpor-internet.com/', '"', html3).replace('"', "") elif html3.find("http://www.malosolandia.com/") > -1: logger.debug("inside here2!..") logger.debug("using malosolandia") newUrl = Decoder.extractWithRegex( 'http://www.malosolandia.com/', '.html', html3) else: logger.debug("nothing done!") if newUrl != "dummy url": logger.debug("html is: " + html3) logger.debug("using new url: " + newUrl) html4 = Cineestrenostv.getContentFromUrl( newUrl, "", Cineestrenostv.cookie, iframeUrl2) logger.debug("redirecting using: " + newUrl + ", html: " + html4) element = Cineestrenostv.mainLogicExtractIframeChannel( html4, newUrl) else: logger.debug(html3) elif html3.find("http://www.rtve.es/directo/la-2/") > -1: element["title"] = "La 2" element["permalink"] = True element[ "link"] = "http://hlslive.rtve.es/LA2_LV3_IPH/LA2_LV3_IPH.m3u8" elif html3.find("http://www.rtve.es/directo/canal-24h/") > -1: element["title"] = "24H" element["permalink"] = True element[ "link"] = "http://hlslive.rtve.es/24H_LV3_IPH/24H_LV3_IPH.m3u8" elif html3.find("http://leton.tv/player.php") > -1: logger.debug("detected leton link...") letonUrl = Decoder.extractWithRegex('http://leton.tv/player.php', '"', html3).replace('"', "") letonHtml = Cineestrenostv.getContentFromUrl( letonUrl, "", Cineestrenostv.cookie, iframeUrl2) #print letonHtml playerUrl = Decoder.decodeLetonTv(letonHtml, letonUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif html3.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: logger.debug( "detected iframe with embed page, doing a new loop again...") iframeUrl3 = Decoder.extract( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="', '"></iframe>', html3) #normal cases, standar width and height if iframeUrl3 != iframeUrl2: html4 = Cineestrenostv.getContentFromUrl( iframeUrl3, "", "", iframeUrl2) return Cineestrenostv.mainLogicExtractIframeChannel( html4, iframeUrl3) else: logger.debug("infinite loop detected, stopped!") elif '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen width="650" height="400" src="http://cinestrenos' in html3: logger.debug("other loop inside...") iframeUrl3 = Decoder.extract( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen width="650" height="400" src="', '"', html3) html4 = Cineestrenostv.getContentFromUrl(url=iframeUrl3, referer=iframeUrl2) logger.debug("using new iframe url: " + iframeUrl3) element = Cineestrenostv.extractIframeChannel(html4, iframeUrl3) else: #tries to decode the bussinesslink, TODO, review this part #print html3 playerUrl = Decoder.decodeBussinessApp(html3, iframeUrl2) logger.debug("bussinessapp - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl return element