def GetStreamUrl(chNum, headers=None): if headers == None: try: cookie = common.OpenURL(filmonMainUrl, justCookie=True) if cookie == None: raise headers = { 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'Keep-Alive', 'Cookie': cookie } except: return None, "Cannot connect to server." user_data = {'channel_id': chNum} try: response = common.OpenURL(filmonChannelUrl, headers, user_data) resultJSON = json.loads(response) if len(resultJSON) < 1 or not resultJSON.has_key("title"): raise channelName, channelDescription, iconimage, streamUrl, tvGuide = GetChannelDetails( resultJSON, chNum, forM3U=True) return headers, streamUrl except: return None, "Cannot Find Stream for channel."
def Resolve(channel): url = 'https://{0}.euronews.com/api/watchlive.json'.format(channel) UA = common.GetUserAgent() headers = {'User-Agent': UA} prms = json.loads(common.OpenURL(url, headers=headers)) prms = json.loads(common.OpenURL('https:{0}'.format(prms['url']), headers=headers)) return '{0}|User-Agent={1}'.format(prms['primary'], UA)
def PlaySRC(): #131 Play series try: url2 = re.sub('(\.link|\.com|\.info)', ".net", url.replace("https", "http")) link = common.OpenURL(url2) desc = re.compile( '<p itemprop=\"description\"><p>(.+)<\/p><\/p>').findall(link) if desc: desc = re.sub( '&([^;]+);', lambda m: unichr(htmlentitydefs.name2codepoint[m.group(1)]), desc[0]).encode('utf-8') player = re.compile( '<iframe name=\"Player\".+src=\"([^\"]+)\"').findall(link) if player: link2 = common.OpenURL(player[0]) urlp = re.compile('file: \"([^\"]+)\"').findall(link2) PlayUrl(name, urlp[0] + "?play|Referer=http://www.redecanais.com/", iconimage, name) else: xbmcgui.Dialog().ok('Cube Play', 'Erro, tente novamente em alguns minutos') except urllib2.URLError, e: xbmcgui.Dialog().ok('Cube Play', 'Erro, tente novamente em alguns minutos')
def MoviesRCL(): #91 Filme Legendado AddDir( "[COLOR red][B][Genero dos Filmes]:[/B] " + Clista2[int(Cat)] + "[/COLOR]", "url", 80, "https://lh5.ggpht.com/gv992ET6R_InCoMXXwIbdRLJczqOHFfLxIeY-bN2nFq0r8MDe-y-cF2aWq6Qy9P_K-4=w300", "https://lh5.ggpht.com/gv992ET6R_InCoMXXwIbdRLJczqOHFfLxIeY-bN2nFq0r8MDe-y-cF2aWq6Qy9P_K-4=w300", isFolder=False) try: p = 1 if int(cPageleg) > 0: AddDir( "[COLOR blue][B]<< Pagina Anterior [" + str(int(cPageleg)) + "[/B]][/COLOR]", cPageleg, 120, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Previous-icon.png", isFolder=False, background="cPageleg") l = int(cPageleg) * 5 for x in range(0, 5): l += 1 link = common.OpenURL( "http://www.redecanais.net/browse-filmes-legendado-videos-" + str(l) + "-date.html") if Clista2[int(Cat)] != "Sem filtro (Mostrar Todos)": link = common.OpenURL("http://www.redecanais.net/browse-" + Clista2[int(Cat)] + "-Filmes-Legendado-videos-" + str(l) + "-date.html") match = re.compile( 'href=\"(https:\/\/www.redecanais[^\"]+).+?src=\"([^\"]+)\".alt=\"([^\"]+)\" wi' ).findall(link) if match: for url2, img2, name2 in match: AddDir(name2, url2, 95, img2, img2, info="") p += 1 if p >= 60: AddDir( "[COLOR blue][B]Proxima Pagina >> [" + str(int(cPageleg) + 2) + "[/B]][/COLOR]", cPageleg, 110, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Next-2-2-icon.png", isFolder=False, background="cPageleg") except e: AddDir("Server error, tente novamente em alguns minutos", "", 0, "", "", 0, cacheMin="0")
def GetChannelHtml(chNum): cookie = common.OpenURL(filmonMainUrl, justCookie=True) if cookie == None: return None headers = { 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'Keep-Alive', 'Cookie': cookie } user_data = {'channel_id': chNum} return common.OpenURL(filmonChannelUrl, headers, user_data)
def Resolve(channel): url = 'https://{0}.euronews.com/api/watchlive.json'.format(channel) UA = common.GetUserAgent() headers = {'User-Agent': UA} prms = json.loads(common.OpenURL(url, headers=headers)) if prms.get('url') == None and prms.get('player') == 'pfp': return 'plugin://plugin.video.youtube/play/?video_id={0}'.format( prms['videoId']) prms = json.loads( common.OpenURL('https:{0}'.format(prms['url']), headers=headers)) return '{0}|User-Agent={1}'.format(prms['primary'], UA)
def PlayTVRC(): # 101 url2 = re.sub('(\.link|\.com|\.info)', ".net", url.replace("https", "http")) try: link = common.OpenURL(url2) player = re.compile( '<iframe name=\"Player\".+src=\"([^\"]+)\"').findall(link) link2 = common.OpenURL(player[0]) urlp = re.compile('\"source\"\: \"([^\"]+)').findall(link2) PlayUrl(name, urlp[0] + "?play|Referer=http://www.redecanais.com/", iconimage, name) except urllib2.URLError, e: xbmcgui.Dialog().ok('Cube Play', 'Erro, tente novamente em alguns minutos')
def Busca(): # 160 AddDir("[COLOR pink][B][Nova Busca][/B][/COLOR]", "", 50, "", isFolder=False) d = xbmcgui.Dialog().input( "Busca (poder demorar a carregar os resultados)").replace(" ", "+") try: p = 1 AddDir("[COLOR blue][B][RedeCanais.com][/B][/COLOR]", "", 0, "", isFolder=False) l = 0 for x in range(0, 10): l += 1 link = common.OpenURL( "http://www.redecanais.net/search.php?keywords=" + d + "&page=" + str(l)) match = re.compile( 'href=\"(https:\/\/www.redecanais[^\"]+).+?src=\"([^\"]+)\".alt=\"([^\"]+)\" wi' ).findall(link) if match: for url2, img2, name2 in match: if re.compile('\d+p').findall(name2): AddDir(name2, url2, 95, img2, img2) elif "Lista" in name2: AddDir(name2, url2, 135, img2, img2) except urllib2.URLError, e: AddDir("Nada encontrado", "", 0, "", "", 0)
def RefreshEPG(): epgLastETag = os.path.join(addon_data_dir, 'epgLastETag.txt') if os.path.isfile(epgLastETag): f = open(epgLastETag, 'r') fileContent = f.read() f.close() else: fileContent = "" URL = "http://thewiz.info/XBMC/_STATIC/guide.xml" req = urllib2.Request(URL) url_handle = urllib2.urlopen(req) headers = url_handle.info() etag = headers.getheader("ETag") #last_modified = headers.getheader("Last-Modified") isNewEPG = fileContent != etag if isNewEPG: f = open(epgLastETag, 'w') f.write(etag) f.close() try: urlContent = common.OpenURL(URL).replace('\r', '') epgFile = os.path.join(addon_data_dir, 'guide.xml') f = open(epgFile, 'w') f.write(urlContent) f.close() except: print "Can't update guide." UpdateIPTVSimpleSettings() return isNewEPG
def TVRC(): # 100 try: l = 0 for x in range(0, 5): l += 1 link = common.OpenURL( "http://www.redecanais.net/browse-canais-videos-" + str(l) + "-title.html") match = re.compile( 'href=\"(https:\/\/www.redecanais[^\"]+).+?src=\"([^\"]+)\".alt=\"([^\"]+)\" wi' ).findall(link) i = 0 if match: for url2, img2, name2 in match: try: name2 = re.sub( '&([^;]+);', lambda m: unichr( htmlentitydefs.name2codepoint[m.group(1)]), name2.replace("Assistir ", "").replace( " - Online - 24 Horas - Ao Vivo", "")).encode('utf-8') except: name2 = name2.replace("Assistir ", "").replace( " - Online - 24 Horas - Ao Vivo", "") #name2 = re.sub('&([^;]+);', lambda m: unichr(htmlentitydefs.name2codepoint[m.group(1)]), name2).encode('utf-8') if cadulto == "8080": AddDir(name2, url2, 101, img2, img2, index=i, cacheMin="0", info="", isFolder=False, IsPlayable=True) elif not "sex" in url2 and not "playboy" in url2: AddDir(name2, url2, 101, img2, img2, index=i, cacheMin="0", info="", isFolder=False, IsPlayable=True) i += 1 except urllib2.URLError, e: AddDir("Server error, tente novamente em alguns minutos", "", 0, "", "", 0, cacheMin="0")
def PlayMRC(): #95 Play filmes try: link = common.OpenURL(url.replace("https", "http")) desc = re.compile( '<p itemprop=\"description\"><p>(.+)<\/p><\/p>').findall(link) if desc: desc = re.sub( '&([^;]+);', lambda m: unichr(htmlentitydefs.name2codepoint[m.group(1)]), desc[0]).encode('utf-8') player = re.compile( '<iframe name=\"Player\".+src=\"([^\"]+)\"').findall(link) if player: link2 = common.OpenURL(player[0]) urlp = re.compile('file: \"([^\"]+)\"').findall(link2) AddDir("[B][COLOR yellow]" + name + " [/COLOR][/B]", urlp[0] + "?play|Referer=http://www.redecanais.com/", 3, iconimage, iconimage, index=0, isFolder=False, IsPlayable=True, info=desc, background=url + ";;;" + name) else: AddDir("[B]Ocorreu um erro[/B]", "", 0, iconimage, iconimage, index=0, isFolder=False, IsPlayable=False, info="Erro") except urllib2.URLError, e: AddDir("Server error, tente novamente em alguns minutos", "", 0, "", "", 0, cacheMin="0")
def Resolve(vid): headers = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.1; Pixel Build/NMF26O) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36', 'Origin': 'https://www.dailymotion.com', 'Referer': 'https://www.dailymotion.com/' } cookie = {'lang': 'en_US', 'ff': 'off'} session = common.GetSession() content = common.OpenURL( "https://www.dailymotion.com/player/metadata/video/{0}".format(vid), session=session, headers=headers, cookies=cookie, responseMethod='json') if content.get('error') is not None: return '' else: cc = content['qualities'] cc = list(cc.items()) cc = sorted(cc, key=s, reverse=True) for source, json_source in cc: for item in json_source: m_url = item.get('url', None) if m_url: m_url = m_url.replace('dvr=true&', '') if '.m3u8?sec' in m_url: text = common.OpenURL( m_url, headers=headers, cookies=session.cookies.get_dict()) mb = re.findall('NAME="([^"]+)"\n(.+)', text) mb = sorted(mb, key=s, reverse=True) for quality, strurl in mb: quality = quality.split("@")[0] if not strurl.startswith('http'): strurl1 = re.findall('(.+/)', m_url)[0] strurl = strurl1 + strurl strurl = '{0}|{1}'.format( strurl.split('#cell')[0], common.urlencode(headers)) return strurl
def PLAYLINK(name, url, iconimage): link = common.OpenURL(url) match = re.compile('hashkey=(.+?)">').findall(link) if len(match) == 0: match = re.compile("hashkey=(.+?)'>").findall(link) if (len(match) > 0): hashurl = "http://videomega.tv/validatehash.php?hashkey=" + match[0] req = urllib2.Request(hashurl, None) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:34.0) Gecko/20100101 Firefox/34.0' ) req.add_header('Referer', url) response = urllib2.urlopen(req) link = response.read() response.close() match = re.compile('var ref="(.+?)"').findall(link)[0] videomega_url = 'http://videomega.tv/?ref=' + match else: match = re.compile("javascript'\>ref='(.+?)'").findall(link)[0] videomega_url = "http://videomega.tv/?ref=" + match ##RESOLVE## url = urlparse.urlparse(videomega_url).query url = urlparse.parse_qs(url)['ref'][0] url = 'http://videomega.tv/cdn.php?ref=%s' % url referer = videomega_url req = urllib2.Request(url, None) req.add_header( 'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) req.add_header('Referer', referer) response = urllib2.urlopen(req) link = response.read() response.close() url = re.compile('document.write.unescape."(.+?)"').findall(link)[-1] url = urllib.unquote_plus(url) print url stream_url = re.compile('file *: *"(.+?)"').findall(url)[0] # CHECK AAASTREAM SECURITY KEY playlist = xbmc.PlayList(1) playlist.clear() listitem = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon) listitem.setInfo("Video", {"Title": name}) listitem.setProperty('mimetype', 'video/x-msvideo') listitem.setProperty('IsPlayable', 'true') playlist.add(stream_url, listitem) xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO) xbmcPlayer.play(playlist)
def MCanais(): #-1 AddDir( "[B][COLOR cyan][Filmes Lançamentos MMFilmes.tv][/COLOR][/B]", "config", 100, "https://walter.trakt.tv/images/movies/000/191/797/fanarts/thumb/6049212229.jpg", "https://walter.trakt.tv/images/movies/000/191/797/fanarts/thumb/6049212229.jpg", isFolder=True) link = common.OpenURL("https://pastebin.com/raw/31SLZ8D8") match = re.compile('(.+);(.+)').findall(link) for name2, url2 in match: AddDir("[COLOR while][B][" + name2 + "][/COLOR][/B]", url2, 102, "http://oi68.tinypic.com/116jn69.jpg", "http://oi68.tinypic.com/116jn69.jpg") setViewM()
def MoviesRCN(): #92 Filmes Nacional try: p = 1 if int(cPagenac) > 0: AddDir( "[COLOR blue][B]<< Pagina Anterior [" + str(int(cPagenac)) + "[/B]][/COLOR]", cPagenac, 120, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Previous-icon.png", isFolder=False, background="cPagenac") l = int(cPagenac) * 5 for x in range(0, 5): l += 1 link = common.OpenURL( "http://www.redecanais.net/browse-filmes-nacional-videos-" + str(l) + "-date.html") match = re.compile( 'href=\"(https:\/\/www.redecanais[^\"]+).+?src=\"([^\"]+)\".alt=\"([^\"]+)\" wi' ).findall(link) if match: for url2, img2, name2 in match: AddDir(name2, url2, 95, img2, img2, info="") p += 1 if p >= 60: AddDir( "[COLOR blue][B]Proxima Pagina >> [" + str(int(cPagenac) + 2) + "[/B]][/COLOR]", cPagenac, 110, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Next-2-2-icon.png", isFolder=False, background="cPagenac") except urllib2.URLError, e: AddDir("Server error, tente novamente em alguns minutos", "", 0, "", "", 0, cacheMin="0")
def SeriesRC(urlrc, pagina2): #130 Lista as Series RC try: pagina = eval(pagina2) p = 1 if int(pagina) > 0: AddDir( "[COLOR blue][B]<< Pagina Anterior [" + str(int(pagina)) + "[/B]][/COLOR]", pagina, 120, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Previous-icon.png", isFolder=False, background=pagina2) l = int(pagina) * 5 for x in range(0, 5): l += 1 link = common.OpenURL("http://www.redecanais.net/browse-" + urlrc + "-videos-" + str(l) + "-title.html") match = re.compile( 'href=\"(https:\/\/www.redecanais[^\"]+).+?src=\"([^\"]+)\".alt=\"([^\"]+)\" wi' ).findall(link) if match: for url2, img2, name2 in match: AddDir(name2, url2, 135, img2, img2, info="") p += 1 if p >= 60: AddDir( "[COLOR blue][B]Proxima Pagina >> [" + str(int(pagina) + 2) + "[/B]][/COLOR]", pagina, 110, "http://icons.iconarchive.com/icons/iconsmind/outline/256/Next-2-2-icon.png", isFolder=False, background=pagina2) except urllib2.URLError, e: AddDir("Server error, tente novamente em alguns minutos", url, 0, "", "", 0, cacheMin="0")
def GETMOVIES(url, name): link = common.OpenURL(url) match = re.compile('href="(.+?)" title="(.+?)">').findall(link) items = len(match) for url, name in match: name2 = AAASTREAM_CODE(name) AAASTREAM_Dir(name2, url, 100, '', len(match)) try: match = re.compile('"nextLink":"(.+?)"').findall(link) url = match[0] url = url.replace('\/', '/') AAASTREAM_Dir('Next Page>>', url, 1, artpath + 'nextpage.png', items, isFolder=True) except: pass if metaset == 'true': setView('movies', 'MAIN') else: xbmc.executebuiltin('Container.SetViewMode(50)')
def RefreshIPTVlinks(): iptvAddon = GetIptvAddon() if iptvAddon == None: return False xbmc.executebuiltin( "XBMC.Notification(ISRALIVE, Updating links..., {0}, {1})".format( 300000, icon)) markedLists = common.GetMarkedLists() markedListsFilename = os.path.join(addon_data_dir, "lists", "markedLists.txt") with open(markedListsFilename, 'w') as outfile: json.dump(markedLists, outfile) outfile.close() isIptvAddonGotham = iptvAddon.getAddonInfo('version') >= "1.9.3" finalList = MakeFinalList(markedLists) finalM3Ulist = MakeM3U(finalList, isIptvAddonGotham) if Addon.getSetting("useM3uPath") == "true": try: f = open(Addon.getSetting("m3uPath"), 'r') lines = f.readlines() f.close() if len(lines) > 0: finalM3Ulist += '\n#EXTINF:-1 tvg-id="Local list" tvg-name="Local list" group-title="{0}" tvg-logo="",[COLOR white][B]--- {1} ---[/B][/COLOR]\nhttp://127.0.0.1\n\n'.format( "ישראלי".decode("windows-1255").encode("utf-8"), localizedString(30207).encode('utf-8')) for line in lines: if line.upper().find('#EXTM3U') == -1: finalM3Ulist += "{0}".format(line) else: finalM3Ulist += "\n" except: pass if Addon.getSetting("useM3uUrl") == "true": try: lines = common.OpenURL(Addon.getSetting("m3uUrl")).replace( '\r', '').split('\n') if len(lines) > 0: finalM3Ulist += '\n#EXTINF:-1 tvg-id="Remote list" tvg-name="Remote list" group-title="{0}" tvg-logo="",[COLOR white][B]--- {1} ---[/B][/COLOR]\nhttp://127.0.0.1\n\n'.format( "ישראלי".decode("windows-1255").encode("utf-8"), localizedString(30208).encode('utf-8')) for line in lines: if line.upper().find('#EXTM3U') == -1: finalM3Ulist += "{0}\n".format(line) except: pass finalM3Ufilename = os.path.join( addon_data_dir, 'iptv.m3u') # The final m3u file. (static + filmon links) f = open( finalM3Ufilename, 'w') # make the finnal m3u list (this file will used in IPTVSimple) f.write(finalM3Ulist) f.close() if os.path.exists( os.path.join( xbmc.translatePath("special://userdata/addon_data").decode( "utf-8"), "pvr.iptvsimple")): DeleteCache() UpdateIPTVSimpleSettings(iptvAddon) xbmc.executebuiltin( "XBMC.Notification(ISRALIVE, Update links is done., {0}, {1})".format( 2000, icon)) return True
def Resolve(channel): url = 'https://api.mediabay.tv/v2/channels/thread/{0}'.format(channel) UA = common.GetUserAgent() headers = {'User-Agent': UA} prms = common.OpenURL(url, headers=headers, responseMethod='json') return '{0}|User-Agent={1}'.format(prms['data'][0]['threadAddress'], UA)
def EpisodiosRC(x): #136 Episodios url2 = re.sub('(\.link|\.com|\.info)', ".net", url.replace("https", "http")) link = common.OpenURL(url2).replace('\n', '').replace('\r', '').replace( '</html>', '<span style="font') temps = re.compile('size: x-large;\">.+?<span style\=\"font').findall(link) if temps: i = 0 epi = re.compile('<strong>(E.+?)<\/strong>(.+?)(<br|<\/p)').findall( temps[int(x)]) else: epi = re.compile('<strong>(E.+?)<\/strong>(.+?)(<br|<\/p)').findall( link) S = 0 if epi: for name2, url2, brp in epi: name3 = re.compile('\d+').findall(name2) if name3: name3 = name3[0] else: name3 = name2 urlm = re.compile('href\=\"(.+?)\"').findall(url2) try: namem = re.sub( '&([^;]+);', lambda m: unichr(htmlentitydefs. name2codepoint[m.group(1)]), re.compile('([^\-]+)').findall(url2)[0]).encode('utf-8') except: namem = re.compile('([^\-]+)').findall(url2)[0] namem = re.sub('<[\/]{0,1}strong>', "", namem) if "<" in namem: namem = "" if urlm: urlm[0] = "http://www.redecanais.net/" + urlm[ 0] if "http" not in urlm[0] else urlm[0] if len(urlm) > 1: urlm[1] = "http://www.redecanais.net/" + urlm[ 1] if "http" not in urlm[1] else urlm[1] AddDir("[COLOR yellow][Dub][/COLOR] " + name3 + " " + namem, urlm[0], 133, iconimage, iconimage, info="", isFolder=False, IsPlayable=True) AddDir("[COLOR blue][Leg][/COLOR] " + name3 + " " + namem, urlm[1], 133, iconimage, iconimage, info="", isFolder=False, IsPlayable=True) elif urlm: AddDir(name3 + " " + namem, urlm[0], 133, iconimage, iconimage, info="", isFolder=False, IsPlayable=True)