def evaluate(host): try: host, referer = host.split('|') if 'openload' in host: from resources.resolvers import openload try: host = openload.get_video_openload(host) except BaseException: host = resolveurl.resolve(host) return host elif 'gamovideo' in host: r = client.request(host, referer=referer) #xbmc.log('@#@GAMO-DATA:%s' % r, xbmc.LOGNOTICE) from resources.modules import jsunpack source = re.findall('''(eval\(function\(p,a,c,k,e,(?:r|d).+?.split\('\|'\)\)\))''', r, re.DOTALL)[0] data = jsunpack.unpack(source) #xbmc.log('@#@GAMO-UNPACK:%s' % data, xbmc.LOGNOTICE) link = re.findall('''file:['"](http.+?v.mp4)['"]''', data, re.DOTALL)[0] #xbmc.log('@#@GAMO-link:%s' % link, xbmc.LOGNOTICE) return link elif 'hqq' in host or 'waaw' in host: from resources.resolvers import netutv media = netutv.get_video_url(host, referer) return media elif resolveurl.HostedMediaFile(host): host = resolveurl.resolve(host) return host else: return host except: return host
def resolver(host): referer = re.sub('embed-', 'player-', host) OPEN = client.request(referer, referer=referer) key = '' for list in find_multiple_matches(OPEN, '_[^=]+=(\[[^\]]+\]);'): if len(list) == 703 or len(list) == 711: key = "".join(eval(list)[7:9]) break if key.startswith("embed"): key = key[6:] + key[:6] matches = find_single_match( OPEN, "<script type=[\"']text/javascript[\"']>(eval.*?)</script>") data = jsunpack.unpack(matches).replace("\\", "") data = find_single_match(data.replace('"', "'"), "sources\s*=[^\[]*\[([^\]]+)\]") print data matches = find_multiple_matches(data, "[src|file]:'([^']+)'") video_urls = [] for video_url in matches: _hash = find_single_match(video_url, '[A-z0-9\_\-]{40,}') hash = decrypt(_hash, key) video_url = video_url.replace(_hash, hash) filename = get_filename_from_url(video_url)[-4:] if video_url.startswith("rtmp"): rtmp, playpath = video_url.split("vod/", 1) video_url = "%svod/ playpath=%s swfUrl=%splayer6/jwplayer.flash.swf pageUrl=%s" % \ (rtmp, playpath, 'http://streamplay.to/', host) filename = "RTMP" elif video_url.endswith("/v.mp4"): video_url_flv = re.sub(r'/v.mp4', '/v.flv', video_url) video_urls.append(["flv [streamplay]", video_url_flv]) video_urls.append([filename + " [streamplay]", video_url]) video_urls.sort(key=lambda x: x[0], reverse=True) return video_urls
def get_links(tv_movie, original_title, season_n, episode_n, season, episode, show_original_year, id): global global_var, stop_all all_links = [] tmdbKey = '653bb8af90162bd98fc7ee32bcbbfb3d' if tv_movie == 'tv': url2 = 'http://api.themoviedb.org/3/tv/%s?api_key=%s&append_to_response=external_ids' % ( id, tmdbKey) else: url2 = 'http://api.themoviedb.org/3/movie/%s?api_key=%s&append_to_response=external_ids' % ( id, tmdbKey) try: imdb_id = get_html(url2, timeout=10).json()['external_ids']['imdb_id'] except: imdb_id = " " if tv_movie == 'tv': x = get_html("https://movies.org/api/releases/tv/%s/%s000%s" % (imdb_id, season, episode_n), headers=base_header, timeout=10).json() else: x = get_html("https://movies.org/api/releases/movie/" + (imdb_id), headers=base_header, timeout=10).json() check_rd = False if Addon.getSetting('debrid_use') == 'true' and Addon.getSetting( 'debrid_select') == '0': from resources.modules import real_debrid rd = real_debrid.RealDebrid() check_rd = True max_size = int(Addon.getSetting("size_limit")) for results in x: nam = results['Release'] link_pre = results['Link'] if '4k' in nam: res = '2160' elif '2160' in nam: res = '2160' elif '1080' in nam: res = '1080' elif '720' in nam: res = '720' elif '480' in nam: res = '480' elif '360' in nam: res = '360' else: res = 'HD' if 'gounlimited.to' in link_pre: y = get_html(link_pre, headers=base_header, timeout=10).content() regex = "<script type='text/javascript'>(.+?)</script>" m2 = re.compile(regex, re.DOTALL).findall(y)[0] from resources.modules.jsunpack import unpack try: data = unpack(m2) data = re.findall('sources:(\[\{.+?\}\])', data, re.DOTALL)[0] try: data = json.loads(data) except: data = data.replace('file', '"file"').replace('label', '"label"') data = json.loads(data) data = [(i['file']) for i in data if data] except: regex = 'src:"(.+?)"' link = re.compile(regex).findall(data)[0] data = [link] for link_in in data: link = 'Direct_link$$$' + link try: try_head = get_html(link_in, headers=base_header, stream=True, verify=False, timeout=3) if 'Content-Length' in try_head.headers: if int(try_head.headers['Content-Length']) > (1024 * 1024): size = (round( float(try_head.headers['Content-Length']) / (1024 * 1024 * 1024), 2)) except: size = 0 if (size) < max_size: all_links.append((nam, link, str(size), res)) global_var = all_links else: if 'clipwatching.com' in link_pre: y = get_html(link_pre, headers=base_header, timeout=10).content() regex = 'src: "(.+?)"' m2 = re.compile(regex, re.DOTALL).findall(y)[0] all_links.append((nam, 'Direct_link$$$' + m2, str(0), res)) global_var = all_links return global_var
def resolve(url, name): # xbmc.log('RESOLVE-URL: %s' % url, xbmc.LOGNOTICE) ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36' # dialog.notification(AddonTitle, '[COLOR skyblue]Attempting To Resolve Link Now[/COLOR]', icon, 5000) if 'acestream' in url: url1 = "plugin://program.plexus/?url=" + url + "&mode=1&name=acestream+" liz = xbmcgui.ListItem(name) liz.setArt({'poster': 'poster.png', 'banner': 'banner.png'}) liz.setArt({ 'icon': iconimage, 'thumb': iconimage, 'poster': iconimage, 'fanart': fanart }) liz.setPath(url) xbmc.Player().play(url1, liz, False) quit() if '/live.cdnz' in url: r = six.ensure_str(client.request(url, referer=BASEURL)).replace('\t', '') # xbmc.log("[{}] - HTML: {}".format(ADDON.getAddonInfo('id'), str(r))) from resources.modules import jsunpack if 'script>eval' in r: unpack = re.findall(r'''<script>(eval.+?\{\}\)\))''', r, re.DOTALL)[0] r = jsunpack.unpack(unpack.strip()) # xbmc.log('RESOLVE-UNPACK: %s' % str(r), xbmc.LOGNOTICE) else: r = r # xbmc.log("[{}] - HTML: {}".format(ADDON.getAddonInfo('id'), str(r))) if 'hfstream.js' in r: regex = '''<script type='text/javascript'> width=(.+?), height=(.+?), channel='(.+?)', g='(.+?)';</script>''' wid, heig, chan, ggg = re.findall(regex, r, re.DOTALL)[0] stream = 'https://www.playerfs.com/membedplayer/' + chan + '/' + ggg + '/' + wid + '/' + heig + '' else: if 'cbox.ws/box' in r: try: stream = client.parseDOM(r, 'iframe', ret='src', attrs={'id': 'thatframe'})[0] except IndexError: streams = client.parseDOM(r, 'iframe', ret='src') stream = [i for i in streams if not 'adca.' in i][0] # xbmc.log("[{}] - STREAM: {}".format(ADDON.getAddonInfo('id'), str(stream))) else: stream = client.parseDOM(r, 'iframe', ret='src')[-1] # xbmc.log("[{}] - STREAM-ELSE: {}".format(ADDON.getAddonInfo('id'), str(stream))) # xbmc.log("[{}] - STREAM: {}".format(ADDON.getAddonInfo('id'), str(stream))) rr = client.request(stream, referer=url) rr = six.ensure_text(rr, encoding='utf-8').replace('\t', '') if 'eval' in rr: unpack = re.findall(r'''script>(eval.+?\{\}\))\)''', rr, re.DOTALL)[0] # unpack = client.parseDOM(rr, 'script') # xbmc.log('UNPACK: %s' % str(unpack)) # unpack = [i.rstrip() for i in unpack if 'eval' in i][0] rr = six.ensure_text(jsunpack.unpack(str(unpack) + ')'), encoding='utf-8') else: r = rr if 'youtube' in rr: try: flink = client.parseDOM(r, 'iframe', ret='src')[0] fid = flink.split('/')[-1] except IndexError: fid = re.findall(r'''/watch\?v=(.+?)['"]''', r, re.DOTALL)[0] # xbmc.log('@#@STREAMMMMM111: %s' % fid, xbmc.LOGNOTICE) flink = 'plugin://plugin.video.youtube/play/?video_id={}'.format( str(fid)) # xbmc.log('@#@STREAMMMMM111: %s' % flink, xbmc.LOGNOTICE) else: if '<script>eval' in rr and not '.m3u8?': unpack = re.findall(r'''<script>(eval.+?\{\}\))\)''', rr, re.DOTALL)[0].strip() # xbmc.log("[{}] - STREAM-UNPACK: {}".format(ADDON.getAddonInfo('id'), str(unpack))) rr = jsunpack.unpack(str(unpack) + ')') # xbmc.log("[{}] - STREAM-UNPACK: {}".format(ADDON.getAddonInfo('id'), str(r))) # else: # xbmc.log("[{}] - Error unpacking".format(ADDON.getAddonInfo('id'))) if 'player.src({src:' in rr: flink = re.findall(r'''player.src\(\{src:\s*["'](.+?)['"]\,''', rr, re.DOTALL)[0] # xbmc.log('@#@STREAMMMMM: %s' % flink, xbmc.LOGNOTICE) elif 'hlsjsConfig' in rr: xbmc.log('MALAKASSSSS26') flink = re.findall(r'''src=\s*["'](.+?)['"]''', rr, re.DOTALL)[0] elif 'new Clappr' in rr: flink = re.findall(r'''source\s*:\s*["'](.+?)['"]\,''', str(rr), re.DOTALL)[0] elif 'player.setSrc' in rr: flink = re.findall(r'''player.setSrc\(["'](.+?)['"]\)''', rr, re.DOTALL)[0] else: try: flink = re.findall(r'''source:\s*["'](.+?)['"]''', rr, re.DOTALL)[0] except IndexError: ea = re.findall(r'''ajax\(\{url:\s*['"](.+?)['"],''', rr, re.DOTALL)[0] ea = six.ensure_text(client.request(ea)).split('=')[1] flink = re.findall('''videoplayer.src = "(.+?)";''', ea, re.DOTALL)[0] flink = flink.replace('" + ea + "', ea) flink += '|Referer={}'.format(quote(stream)) # xbmc.log('@#@STREAMMMMM111: %s' % flink, xbmc.LOGNOTICE) stream_url = flink else: stream_url = url liz = xbmcgui.ListItem(name) liz.setArt({'poster': 'poster.png', 'banner': 'banner.png'}) liz.setArt({ 'icon': iconimage, 'thumb': iconimage, 'poster': iconimage, 'fanart': fanart }) liz.setInfo(type="Video", infoLabels={"Title": name}) liz.setProperty("IsPlayable", "true") liz.setPath(str(stream_url)) # if float(xbmc.getInfoLabel('System.BuildVersion')[0:4]) >= 17.5: # liz.setMimeType('application/vnd.apple.mpegurl') # liz.setProperty('inputstream.adaptive.manifest_type', 'hls') # liz.setProperty('inputstream.adaptive.stream_headers', str(headers)) # else: # liz.setProperty('inputstreamaddon', None) # liz.setContentLookup(True) xbmc.Player().play(stream_url, liz, False) quit()
def PLAY_VIDEO(link): soup = SOUPIFY(link) #http://kisscartoon.so/ (<iframe class="metaframe rptss" src="">) iframe_source = soup.find('iframe', {'class': 'metaframe rptss'}) soup = SOUPIFY(iframe_source['src']) #http://hnmovies.com/ (<div class="pestana" data-src="">) links = [] titles = [] dialog = xbmcgui.Dialog() link_divs = soup.findAll('div', {'class': 'pestana'}) if len(link_divs) == 0: link_divs = soup.findAll('div', {'data-target': '#iframe'}) links = [div['data-src'] for div in link_divs] titles = [div.span.text for div in link_divs] ret = dialog.select('Choose a Source', titles) if ret > -1: link_source = links[ret] if not link_source.startswith('http'): link_source = SOUPIFY('http:' + link_source) try: links.append(link_source.iframe['src']) except: removed = re.compile( """This video doesn't exist""").findall( str(link_source))[0] if removed: e = 'This video has been removed. Please try another link' xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (addonname, e, 10000, icon)) return juicy_code = re.compile( """JuicyCodes.Run\("(.+?)"\)""").findall( str(link_source))[0].replace('"+"', '') js = base64.b64decode(juicy_code) jsdone = jsunpack.unpack(js) print jsdone match = re.compile("""file":"([^"']+)","label":"([^"']+)""" ).findall(jsdone) titles = [] for url, quality in match: links.append(url) titles.append(quality) else: links.append(link_source) titles.append('') else: for i, link in enumerate(link_divs): if not link['data-src'].startswith('http'): soup = SOUPIFY('http:' + link['data-src']) links.append(soup.find('iframe')['src']) else: links.append(link['data-src']) titles.append('Link %s' % str(i + 1)) ret = dialog.select('Choose a Stream', titles) if ret > -1: play_link = links[ret] if urlresolver.HostedMediaFile(play_link).valid_url(): try: play_link = urlresolver.HostedMediaFile(play_link).resolve() except: play_link = play_link li = xbmcgui.ListItem('') li.setPath(play_link) xbmc.Player().play(play_link, li, False) quit()