def zalogujponownie(exlink): sess.cookies.clear() username = addon.getSetting('username') password = addon.getSetting('password') logowanie = addon.getSetting('logowanie') if username and password and logowanie == 'true': headers = { 'Host': 'hejo.tv', 'User-Agent': UA, 'Accept': 'text/html', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'DNT': '1', 'Upgrade-Insecure-Requests': '1', } response = sess.get('http://hejo.tv/', headers=headers, verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') unpacked = '' packeds = packer2.findall(response) # [0] for packed in packeds: unpacked += jsunpack.unpack(packed) unpacked = unpacked.replace("\\'", '"') try: kukz = re.findall( """setCookie\(['"](.+?)['"],['"](.+?)['"]""", unpacked)[0] nowy_cookie = requests.cookies.create_cookie(kukz[0], kukz[1]) sess.cookies.set_cookie(nowy_cookie) response = sess.get('http://hejo.tv/', verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') except: pass token = parseDOM(response, 'meta', attrs={ 'name': 'csrf-token'}, ret='content')[0] data = {'_token': token, 'username': username, 'password': password} response = sess.post('https://hejo.tv/login', data=data, verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') unpacked = '' packeds = packer2.findall(response) # [0] for packed in packeds: unpacked += jsunpack.unpack(packed) unpacked = unpacked.replace("\\'", '"') kukz = re.findall( """setCookie\(['"](.+?)['"],['"](.+?)['"]""", unpacked)[0] nowy_cookie = requests.cookies.create_cookie(kukz[0], kukz[1]) sess.cookies.set_cookie(nowy_cookie) html = sess.get('https://hejo.tv/login', verify=False).content if PY3: html = html.decode(encoding='utf-8', errors='strict') if html.find('logowany jako') > 0: sess.cookies.save(COOKIEFILE, ignore_discard=True) return
def getVideosOk(url): html = getUrl(url) packeds = packer.findall(html) for packed in packeds: unpack = jsunpack.unpack(packed) try: player = re.findall('"(\/player.+?)"', unpack) if not player: player = re.findall('"(.+?\/player.*?)"', unpack) if player: player = player[0] break except: pass nexturl = player if player.startswith('http') else 'https://hejo.tv'+player html = getUrl(nexturl) stream = re.findall('src="(.+?)"', html)[0] stream = 'https:'+stream if stream.startswith('//') else stream if not 'mp4' in stream: stream = getUrl(stream, False) stream = stream.headers['Location'] kuk = cookieString(COOKIEFILE) return stream+'|User-Agent='+quote(UA)+'&Referer='+BASEURL+'&Cookie='+quote(kuk)
def get_videos(self, url): videos = [] if 'cinebix.com' in url: self.resolve_media(url, videos) return videos html = requests.get(url, headers=self.hdr).text try: linkcode = jsunpack.unpack(html).replace('\\', '') sources = json.loads(re.findall('sources:(.*?)\}\)', linkcode)[0]) for source in sources: url = source['file'] + '|Referer=http://%s/' % self.get_vidhost( source['file']) url = urllib.quote_plus(url) videos.append(('tamilgun | %s' % source['label'], url)) except: pass mlink = SoupStrainer('div', {'id': 'videoframe'}) videoclass = BeautifulSoup(html, parseOnlyThese=mlink) try: links = videoclass.findAll('iframe') for link in links: url = link.get('src') self.resolve_media(url, videos) except: pass mlink = SoupStrainer('div', {'class': 'entry-excerpt'}) videoclass = BeautifulSoup(html, parseOnlyThese=mlink) try: links = videoclass.findAll('iframe') for link in links: if 'http' in str(link): url = link.get('src') self.resolve_media(url, videos) except: pass try: links = videoclass.findAll('p') for link in links: if 'http' in str(link): url = link.a.get('href') self.resolve_media(url, videos) except: pass try: sources = json.loads(re.findall('vdf-data-json">(.*?)<', html)[0]) url = 'https://www.youtube.com/watch?v=%s' % sources['videos'][0][ 'youtubeID'] self.resolve_media(url, videos) except: pass return videos
def get_videos(self, url): videos = [] html = requests.get(url, headers=self.hdr).text surl = re.findall('em_code_sel".+?(http[^<]+)', html)[0] if '&' in surl: surl = surl.split('&')[0] try: linkcode = requests.get(surl, headers=self.hdr).text if ('sources:' not in linkcode) and ('<iframe' not in linkcode): linkcode = jsunpack.unpack(linkcode).replace('\\', '') #xbmc.log("DeccanDelight vid_url = %s" %vid_url,xbmc.LOGNOTICE) if 'sources:' in linkcode: sources = json.loads( re.findall('sources:(.*?}])', linkcode)[0]) for source in sources: url = source['file'] url = urllib.quote_plus(url) videos.append(('tmvplay | %s' % source['label'], url)) elif '<iframe' in linkcode: vidurl = re.findall('<iframe.+?src="([^"]+)', linkcode)[0] self.resolve_media(vidurl, videos) else: url = re.findall('file:\s*"([^"]+)', linkcode)[0] url = urllib.quote_plus(url) videos.append(('tmvplay', url)) except: pass else: self.resolve_media(surl, videos) return videos
def HCPlayvid(url, name, download=None): progress.create('Play video', 'Searching videofile.') progress.update(10, "", "Loading video page", "") link = utils.getHtml(url, '') match = re.compile('<iframe.*? src="([^"]+)" FRAME', re.DOTALL | re.IGNORECASE).findall(link) if len(match) > 1: vh = dialog.select('Videohost:', match) if vh == -1: return else: vh = 0 progress.update(40, "", "Loading video host", "") urldata2 = getHC(match[vh]) if match[vh].find('hentaiupload') > 0: progress.update(80, "", "Loading hentaiupload", "") try: match1 = re.compile('url: "([^"]+mp4)', re.DOTALL | re.IGNORECASE).findall(urldata2) url = match1[0] except: pass videourl = url + "|referer=" + match[vh] elif match[vh].find('hvidengine') > 0: progress.update(80, "", "Loading hvidengine", "") try: match1 = re.compile('file: "([^"]+)', re.DOTALL | re.IGNORECASE).findall(urldata2) url = match1[0] except: pass videourl = url + "|referer=" + match[vh] else: progress.update(80, "", "Loading video uphentaivid", "") match2 = re.compile("<script type='text/javascript'>([^<]+)</sc", re.DOTALL | re.IGNORECASE).findall(urldata2) for jspacked in match2: res = unpack(jspacked) try: videourl = re.compile("file.*?(http.*?mp4)", re.DOTALL | re.IGNORECASE).findall(res)[0] except: videourl = None progress.close() if videourl: if download == 1: utils.downloadVideo(videourl, name) else: iconimage = xbmc.getInfoImage("ListItem.Thumb") listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name, 'Genre': 'P**n'}) xbmc.Player().play(videourl, listitem)
def resolve(url): try: result = client.request(url, referer=url) for match in re.finditer('(eval\(function.*?)</script>', result, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) r = re.search('file\s*:\s*"([^"]+)', js_data) if r: return r.group(1) r = re.search('file\s*:\s*"([^"]+)', html) if r: return r.group(1) except: return
def get_video(self, url): html = requests.get(url, headers=self.hdr).text surl = re.findall('<iframe.*?src="([^"]+)', html)[0] if 'http' not in surl: up = urlparse.urlparse(url) surl = '%s://%s' % (up.scheme, up.netloc) + surl shtml = requests.get(surl, headers=self.hdr).text if '.m3u8' not in shtml: linkcode = jsunpack.unpack(shtml).replace('\\', '') r = re.search('file:\s*"([^"]+)', linkcode) if r: strurl = r.group(1) + '|User-Agent=' + self.hdr['User-Agent'] else: strurl = 'http://projects.net.in.tum.de/projects/videoaufzeichnungen/export/339/andre/public/vids/ilab1/video.mp4' else: strurl = re.findall('''(http.+?\.m3u8[^\s'"]+)''', shtml)[0] return strurl
def HCPlayvid(url,name, download=None): progress.create('Play video', 'Searching videofile.') progress.update( 10, "", "Loading video page", "" ) link = utils.getHtml(url,'') match = re.compile('<iframe.*? src="([^"]+)" FRAME', re.DOTALL | re.IGNORECASE).findall(link) if len(match) > 1: vh = dialog.select('Videohost:', match) if vh == -1: return else: vh = 0 progress.update( 40, "", "Loading video host", "" ) urldata2 = getHC(match[vh]) if match[vh].find('hentaiupload') > 0: progress.update( 80, "", "Loading hentaiupload", "" ) try: match1 = re.compile('url: "([^"]+mp4)', re.DOTALL | re.IGNORECASE).findall(urldata2) url = match1[0] except: pass videourl = url + "|referer="+ match[vh] elif match[vh].find('hvidengine') > 0: progress.update( 80, "", "Loading hvidengine", "" ) try: match1 = re.compile('file: "([^"]+)', re.DOTALL | re.IGNORECASE).findall(urldata2) url = match1[0] except: pass videourl = url + "|referer="+ match[vh] else: progress.update( 80, "", "Loading video uphentaivid", "" ) match2 = re.compile("<script type='text/javascript'>([^<]+)</sc", re.DOTALL | re.IGNORECASE).findall(urldata2) for jspacked in match2: res = unpack(jspacked) try: videourl = re.compile("file.*?(http.*?mp4)", re.DOTALL | re.IGNORECASE).findall(res)[0] except: videourl = None progress.close() if videourl: if download == 1: utils.downloadVideo(videourl, name) else: iconimage = xbmc.getInfoImage("ListItem.Thumb") listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name, 'Genre': 'P**n'}) xbmc.Player().play(videourl, listitem)
def dodajKuki(html): packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') unpacked = '' packeds = packer2.findall(html) for packed in packeds: unpacked += jsunpack.unpack(packed) unpacked = unpacked.replace("\\'", '"') kukz = re.findall( """setCookie\(['"](.+?)['"],['"](.+?)['"]""", unpacked) # [0] if kukz: kukz = kukz[0] nowy_cookie = requests.cookies.create_cookie(kukz[0], kukz[1]) sess.cookies.set_cookie(nowy_cookie) sess.cookies.save(COOKIEFILE, ignore_discard=True) return True else: return False
def resolve(url): # try: urls = re.sub(r'(?:http:|)\/\/', 'http://', url) # result = client.request(urls, referer=urls) result = getContent(urls) packed = re.search('(eval\(function\(p,a,c,k,e,d\)\{.+\))', result) unpacked = None if packed: # change radix before trying to unpack, 58-61 seen in testing, 62 worked for all packed = re.sub(r"(.+}\('.*', *)\d+(, *\d+, *'.*?'\.split\('\|'\))", "\g<01>62\g<02>", packed.group(1)) unpacked = jsunpack.unpack(packed) if unpacked: r = re.search('.+["\']file["\']\s*:\s*["\'](.+?/video\\\.+?)["\']', unpacked) if r: stream_url = r.group(1).replace('\\', '') if stream_url: return stream_url
def Playvid(url, name, download=None): vp = utils.VideoPlayer(name, download) vp.progress.update(25, "[CR]Loading video page[CR]") videopage = utils.getHtml(url) refurl = re.compile(r'class="video-embedded">\s*<iframe[^>]+src="(http[^"]+)"', re.DOTALL | re.IGNORECASE).findall(videopage)[0] vp.progress.update(50, "[CR]Loading video page[CR]") refpage = utils.getHtml(refurl) if '/playerz/' in refurl: videourl = re.compile(r'"src":"\.([^"]+)"', re.DOTALL | re.IGNORECASE).findall(refpage)[0] videourl = refurl.split('/ss.php')[0] + videourl videourlpage = utils.getHtml(videourl) vp.direct_regex = '{"file":"([^"]+)"' vp.play_from_html(videourlpage) else: videourl = re.compile(r'>(eval.+?)<\/script>', re.DOTALL | re.IGNORECASE).findall(refpage)[0] videourl = unpack(videourl) videolink = re.compile('file:"([^"]+)"', re.DOTALL | re.IGNORECASE).findall(videourl)[0] videolink = videolink + '|Referer=' + refurl vp.play_from_direct_link(videolink)
def resolve(url): try: url = url.replace('/embed-', '/') url = re.compile('//.+?/([\w]+)').findall(url)[0] url = 'http://vidto.me/embed-%s.html' % url result = client.request(url) result = re.compile('(eval.*?\)\)\))').findall(result)[-1] result = jsunpack.unpack(result) url = client.parseDOM(result, 'embed', ret='src') url += re.compile("file *: *[\'|\"](http.+?)[\'|\"]").findall(result) url = [i for i in url if not i.endswith('.srt')] url = 'http://' + url[0].split('://', 1)[-1] return url except: return
def run(e): try: e = re.findall(r'JuicyCodes.Run\(([^\)]+)', e, re.IGNORECASE)[0] e = re.sub(r'\"\s*\+\s*\"', '', e) e = re.sub(r'[^A-Za-z0-9+\\/=]', '', e) except BaseException: return None t = "" n = r = i = s = o = u = a = f = 0 while f < len(e): try: s = Juice.index(e[f]) f += 1 o = Juice.index(e[f]) f += 1 u = Juice.index(e[f]) f += 1 a = Juice.index(e[f]) f += 1 n = s << 2 | o >> 4 r = (15 & o) << 4 | u >> 2 i = (3 & u) << 6 | a t += chr(n) if 64 != u: t += chr(r) if 64 != a: t += chr(i) except BaseException: continue pass try: t = jsunpack.unpack(t) t = six.text_type(t, 'utf-8') except BaseException: t = None return t
def resolve(url): try: url = url.replace('/embed-', '/') url = re.compile('//.+?/([\w]+)').findall(url)[0] url = 'http://turbovideos.net/embed-%s.html' % url result = client.request(url) url = re.compile('file *: *"(.+?)"').findall(result) if len(url) > 0: return url[0] result = re.compile('(eval.*?\)\)\))').findall(result)[-1] result = jsunpack.unpack(result) url = client.parseDOM(result, 'embed', ret='src') url += re.compile("file *: *[\'|\"](.+?)[\'|\"]").findall(result) url = [i for i in url if not i.endswith('.srt')] url = 'http://' + url[0].split('://', 1)[-1] return url except: return
def login(): username = addon.getSetting('username') password = addon.getSetting('password') logowanie = addon.getSetting('logowanie') if username and password and logowanie == 'true': headers = { 'Host': 'hejo.tv', 'User-Agent': UA, 'Accept': 'text/html', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'DNT': '1', 'Upgrade-Insecure-Requests': '1', } response = sess.get('http://hejo.tv/', verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') unpacked = '' packeds = packer2.findall(response) # [0] for packed in packeds: unpacked += jsunpack.unpack(packed) unpacked = unpacked.replace("\\'", '"') xbmc.log("Unpacked = {}".format(unpacked), level=xbmc.LOGINFO) try: kukz = re.findall( """setCookie\(['"](.+?)['"],['"](.+?)['"]""", unpacked)[0] nowy_cookie = requests.cookies.create_cookie(kukz[0], kukz[1]) sess.cookies.set_cookie(nowy_cookie) response = sess.get('http://hejo.tv/', headers=headers, verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') except: pass token = parseDOM(response, 'meta', attrs={ 'name': 'csrf-token'}, ret='content')[0] headers2 = { 'Host': 'hejo.tv', 'user-agent': UA, 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'accept-language': 'pl,en-US;q=0.7,en;q=0.3', 'content-type': 'application/x-www-form-urlencoded', 'origin': 'https://hejo.tv', 'referer': 'https://hejo.tv/', 'upgrade-insecure-requests': '1', 'te': 'trailers', } # data = {'_token': token,'username': username,'password': password} data = '_token={}&username={}&password={}'.format( token, username, quote(password)) response = sess.post('https://hejo.tv/login', data=data, headers=headers2, verify=False).content if PY3: response = response.decode(encoding='utf-8', errors='strict') packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') unpacked = '' packeds = packer2.findall(response) # [0] for packed in packeds: unpacked += jsunpack.unpack(packed) unpacked = unpacked.replace("\\'", '"') kukz = re.findall( """setCookie\(['"](.+?)['"],['"](.+?)['"]""", unpacked) # [0] if kukz: kukz = kukz[0] nowy_cookie = requests.cookies.create_cookie(kukz[0], kukz[1]) sess.cookies.set_cookie(nowy_cookie) html = sess.get('https://hejo.tv/login', headers=headers, cookies=sess.cookies, verify=False).content if PY3: html = html.decode(encoding='utf-8', errors='strict') if html.find('> Wyloguj się<') > 0: sess.cookies.save(COOKIEFILE, ignore_discard=True) if 'Wykup konto premium' in html: typ = ' [COLOR red](darmowe)[/COLOR]' else: info = (re.findall('>(Premium do.+?)</a>', html)[0]).lower() typ = ' [COLOR khaki](%s)[/COLOR]' % info log1 = re.findall( """class="fa fa-user" aria-hidden="true"></i>([^<]+)<""", html)[0] zalog = 'Zalogowany jako [COLOR khaki]%s[/COLOR]' % log1.strip() add_item('', '[B](%s)[/B] -%s' % (zalog, typ), '', False, 'settings') else: s = xbmcgui.Dialog().ok( '[COLOR red]Problem[/COLOR]', 'Błąd logowania :-(') add_item(url='', name='[B]Zaloguj[/B]', mode='settings', image='', folder=False, isplay=False) else: add_item(url='', name='[B]Zaloguj[/B]', mode='settings', image='', folder=False, isplay=False)
def resolve_media(self, url, videos, vidtxt=''): non_str_list = [ 'olangal.', '#', 'magnet:', 'desihome.', 'thiruttuvcd', 'cineview', 'bollyheaven', 'videolinkz', 'moviefk.co', 'goo.gl', 'imdb.', 'mgid.', 'atemda.', 'movierulz.', 'facebook.', 'm2pub', 'abcmalayalam', 'india4movie.co', '.filmlinks4u', 'tamilraja.', 'multiup.', 'filesupload.', 'fileorbs.', 'tamil.ws', 'insurance-donate.', '.blogspot.', 'yodesi.net', 'desi-tashan.', 'yomasti.co/ads', 'ads.yodesi', '/ads/', 'mylifeads.' ] embed_list = [ 'cineview', 'bollyheaven', 'videolinkz', 'vidzcode', 'embedzone', 'embedsr', 'fullmovie-hd', 'links4.pw', 'embedscr', 'embedrip', 'movembed', 'power4link.us', 'watchmoviesonline4u', 'nobuffer.info', 'yomasti.co', 'techking.me', 'onlinemoviesworld.xyz', 'cinebix.com', 'desihome.', 'loan-forex.', 'filmshowonline.', 'vids.xyz', 'business-tv.me', 'telly-news.', 'tellytimes.', 'techking.', 'adly.biz', 'business-', 'businessvoip.', 'toptencar.', 'loanadvisor.' ] if 'filmshowonline.net/media/' in url: try: r = requests.get(url, headers=self.hdr) clink = r.text cookies = r.cookies eurl = re.findall("var height.*?url: '(.*?)'", clink, re.DOTALL)[0] enonce = re.findall("var height.*?nonce.*?'(.*?)'", clink, re.DOTALL)[0] evid = re.findall("var height.*?link_id: ([^\s]*)", clink, re.DOTALL)[0] values = { 'echo': 'true', 'nonce': enonce, 'width': '848', 'height': '480', 'link_id': evid } headers = self.hdr headers['Referer'] = url headers['X-Requested-With'] = 'XMLHttpRequest' emurl = requests.post(eurl, data=values, headers=headers, cookies=cookies).text strurl = (re.findall('(http[^"]*)', emurl)[0]).replace('\\', '') if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) except: pass elif 'justmoviesonline.com' in url: html = requests.get(url, headers=mozhdr).text src = re.search("atob\('(.*?)'", html) if src: src = src.group(1) try: strurl = re.findall('file":"(.*?)"', src.decode('base64'))[0] vidhost = 'GVideo' strurl = urllib.quote_plus(strurl) videos.append((vidhost, strurl)) except: pass try: strurl = re.findall('''source src=["'](.*?)['"]''', src.decode('base64'))[0] vidhost = self.get_vidhost(strurl) videos.append((vidhost, strurl)) except: pass elif '?id=' in url: src = eval( re.findall('Loading.+?var.+?=([^;]+)', html, re.DOTALL)[0]) for item in src: if 'http' in item and 'justmovies' not in item: strurl = item strurl += url.split('?id=')[1] strurl += '.mp4|User-Agent=%s' % mozhdr['User-Agent'] vidhost = 'GVideo' strurl = urllib.quote_plus(strurl) videos.append((vidhost, strurl)) elif 'videohost.site' in url or 'videohost1.com' in url: try: html = requests.get(url, headers=mozhdr).text pdata = eval(re.findall('Run\((.*?)\)', html)[0]).decode('base64') linkcode = jsunpack.unpack(pdata).replace('\\', '') sources = json.loads( re.findall('sources:(.*?\}\])', linkcode)[0]) for source in sources: strurl = source['file'] + '|Referer=%s' % url vidhost = self.get_vidhost( url) + ' | GVideo | %s' % source['label'] strurl = urllib.quote_plus(strurl) videos.append((vidhost, strurl)) except: pass elif 'videohost2.com' in url: html = requests.get(url, headers=mozhdr).text try: pdata = eval( re.findall('Loading video.+?(\[.+?\]);', html, re.DOTALL)[0]) if 'id=' in url: strurl = pdata[7] + url.split('=')[1] + pdata[9] else: strurl = pdata[7] vidhost = self.get_vidhost(url) + ' | GVideo' strurl = urllib.quote_plus(strurl + '|Referer=%s' % url) videos.append((vidhost, strurl)) except: pass try: pdata = re.findall("atob\('([^']+)", html)[0].decode('base64') strurl = re.findall("source\ssrc='([^']+)", pdata)[0] + '|Referer=%s' % url vidhost = self.get_vidhost(url) strurl = urllib.quote_plus(strurl) videos.append((vidhost, strurl)) except: pass elif 'tamildbox' in url: link = requests.get(url, headers=mozhdr).text try: mlink = SoupStrainer('div', {'id': 'player-embed'}) dclass = BeautifulSoup(link, parseOnlyThese=mlink) if 'unescape' in str(dclass): etext = re.findall("unescape.'[^']*", str(dclass))[0] etext = urllib.unquote(etext) dclass = BeautifulSoup(etext) glink = dclass.iframe.get('src') if resolveurl.HostedMediaFile(glink): vidhost = self.get_vidhost(glink) videos.append((vidhost, glink)) except: pass try: mlink = SoupStrainer('div', {'class': re.compile('^item-content')}) dclass = BeautifulSoup(link, parseOnlyThese=mlink) glink = dclass.p.iframe.get('src') if resolveurl.HostedMediaFile(glink): vidhost = self.get_vidhost(glink) videos.append((vidhost, glink)) except: pass try: if 'p,a,c,k,e,d' in link: linkcode = jsunpack.unpack(link).replace('\\', '') glink = re.findall("file\s*:\s*'(.*?)'", linkcode)[0] if 'youtu.be' in glink: glink = 'https://docs.google.com/vt?id=' + glink[16:] if resolveurl.HostedMediaFile(glink): vidhost = self.get_vidhost(glink) videos.append((vidhost, glink)) except: pass try: codes = re.findall('"return loadEP.([^,]*),(\d*)', link) for ep_id, server_id in codes: burl = 'http://www.tamildbox.com/actions.php?case=loadEP&ep_id=%s&server_id=%s' % ( ep_id, server_id) bhtml = requests.get(burl, headers=mozhdr).text blink = re.findall('(?i)iframe\s*src="(.*?)"', bhtml)[0] vidhost = self.get_vidhost(blink) if 'googleapis' in blink: blink = 'https://drive.google.com/open?id=' + re.findall( 'docid=([^&]*)', blink)[0] vidhost = 'GVideo' videos.append((vidhost, blink)) except: pass elif any([x in url for x in embed_list]): clink = requests.get(url, headers=mozhdr).text csoup = BeautifulSoup(clink) try: links = re.findall('''(?i)<iframe.+?src=["']([^'"]+)''', clink) for strurl in links: #xbmc.log('-------> Scraped link : %s' % strurl, xbmc.LOGNOTICE) if not any([x in strurl for x in non_str_list]): #xbmc.log('-------> sending to resolveurl for checking : %s' % strurl, xbmc.LOGNOTICE) if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) else: xbmc.log( '-------> resolveurl cannot resolve : %s' % strurl, xbmc.LOGNOTICE) except: pass try: plink = csoup.find('a', {'class': 'main-button dlbutton'}) strurl = plink.get('href') if not any([x in strurl for x in non_str_list]): if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) except: pass try: plink = csoup.find('div', {'class': 'aio-pulse'}) strurl = plink.find('a')['href'] if not any([x in strurl for x in non_str_list]): if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) except: pass try: plink = csoup.find('div', {'class': re.compile('entry-content')}) strurl = plink.find('a')['href'] if not any([x in strurl for x in non_str_list]): if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) except: pass try: for linksSection in csoup.findAll('embed'): strurl = linksSection.get('src') if not any([x in strurl for x in non_str_list]): if resolveurl.HostedMediaFile(strurl): vidhost = self.get_vidhost(strurl) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, strurl)) except: pass elif not any([x in url for x in non_str_list]): if resolveurl.HostedMediaFile(url): vidhost = self.get_vidhost(url) if not vidtxt == '': vidhost += ' | %s' % vidtxt videos.append((vidhost, url)) else: xbmc.log('-------> ResolveUrl cannot resolve : %s' % url, xbmc.LOGNOTICE) return
def player(name,url,iconimage): OK = True mensagemprogresso = xbmcgui.DialogProgress() mensagemprogresso.create('HORA DA PIPOCA', 'Obtendo Fontes para ' + name, 'Por favor aguarde...') mensagemprogresso.update(0) titsT = [] idsT = [] matriz = [] link = openURL(url) soup = BeautifulSoup(link) try : conteudo = soup("div", {"class": "pn-opcoes pn-dub"}) srvsdub = conteudo[0]("li") totD = len(srvsdub) tipo = "Dublado" for i in range(totD) : t**S = srvsdub[i].text.encode('utf-8','ignore') + " (%s)" % tipo if not 'Principal' in t**S : if not 'DropVideo' in t**S : if not 'Vídeo PW' in t**S : if not 'YouWatch' in t**S : if not 'Youwatch' in t**S : if not 'NeoDrive' in t**S : idS = srvsdub[i]["data-pid"] titsT.append(t**S) idsT.append(idS) except : pass try : conteudo = soup("div", {"class": "pn-opcoes pn-leg"}) srvsleg = conteudo[0]("li") totL = len(srvsleg) tipo = "Legendado" for i in range(totL) : t**S = srvsleg[i].text.encode('utf-8','ignore') + " (%s)" % tipo if not 'Principal' in t**S : if not 'DropVideo' in t**S : if not 'Vídeo PW' in t**S : if not 'YouWatch' in t**S : if not 'Youwatch' in t**S : if not 'NeoDrive' in t**S : idS = srvsleg[i]["data-pid"] titsT.append(t**S) idsT.append(idS) except : pass if not titsT : return index = xbmcgui.Dialog().select('Selecione uma das fontes suportadas :', titsT) if index == -1 : return ind = idsT[index] conteudo = soup("li", {"class": "pi-item"+ind}) links = conteudo[0]("iframe") if len(links) == 0 : links = conteudo[0]("embed") for link in links : urlVideo = link["data-src"] print "URLVIDEO " + urlVideo mensagemprogresso.update(50, 'Resolvendo fonte para ' + name,'Por favor aguarde...') if 'nowvideo.php' in urlVideo : nowID = urlVideo.split("id=")[1] urlVideo = 'http://embed.nowvideo.sx/embed.php?v=%s' % nowID elif 'video.tt' in urlVideo : vttID = urlVideo.split('e/')[1] urlVideo = 'http://www.video.tt/watch_video.php?v=%s' % vttID elif 'flashx.php' in urlVideo : fxID = urlVideo.split('id=')[1] urlVideo = 'http://www.flashx.tv/embed-%s.html' % fxID elif 'thevid.net' in urlVideo : linkTV = openURL(urlVideo) js_data = jsunpack.unpack(linkTV) url2Play = re.findall('var vurl2="(.*?)"', js_data)[0] OK = False if OK : url2Play = urlresolver.resolve(urlVideo) if not url2Play : return legendas = '-' mensagemprogresso.update(75, 'Abrindo Sinal para ' + name,'Por favor aguarde...') playlist = xbmc.PlayList(1) playlist.clear() listitem = xbmcgui.ListItem(name,thumbnailImage=iconimage) listitem.setPath(url2Play) listitem.setProperty('mimetype','video/mp4') listitem.setProperty('IsPlayable', 'true') playlist.add(url2Play,listitem) xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO) xbmcPlayer.play(playlist) mensagemprogresso.update(100) mensagemprogresso.close() if legendas != '-': if 'timedtext' in legendas: import os.path sfile = os.path.join(xbmc.translatePath("special://temp"),'sub.srt') sfile_xml = os.path.join(xbmc.translatePath("special://temp"),'sub.xml')#timedtext sub_file_xml = open(sfile_xml,'w') sub_file_xml.write(urllib2.urlopen(legendas).read()) sub_file_xml.close() xmltosrt.main(sfile_xml) xbmcPlayer.setSubtitles(sfile) else: xbmcPlayer.setSubtitles(legendas)
def unpack_javascript_code(html, pattern='(eval\(function\(p,a,c,k,e,d\).+?{}\)\))'): regexp = re.compile(pattern) found = regexp.findall(html) return ''.join(list(map(lambda item: jsunpack.unpack(item), found)))
def Playvid(url, name, download=None): vp = utils.VideoPlayer(name, download) vp.progress.update(25, "[CR]Loading video page[CR]") videopage = utils.getHtml(url, site.url) eurls = re.compile(r'<li><a\s*href="([^"]+)"\s*>\s*([^<]+)', re.DOTALL | re.IGNORECASE).findall(videopage) sources = {} for eurl, ename in eurls: if eurl != '?server=1': videopage = utils.getHtml(url + eurl, '') embedurl = re.compile('<iframe.+?src="([^"]+)', re.DOTALL | re.IGNORECASE).findall(videopage)[0] if 'filestar.club' in embedurl: embedurl = utils.getVideoLink(embedurl, url) if '//' in embedurl: sources[enames[ename]] = embedurl videourl = utils.selector('Select Hoster', sources) if not videourl: vp.progress.close() return if 'gdriveplayer.to' in videourl: videourl = videourl.split('data=')[-1] while '%' in videourl: videourl = urllib_parse.unquote(videourl) videohtml = utils.getHtml('https:' + videourl, site.url) ptext = jsunpack.unpack(videohtml).replace('\\', '') ct = re.findall(r'"ct":"([^"]+)', ptext)[0] salt = codecs.decode(re.findall(r'"s":"([^"]+)', ptext)[0], 'hex') pf = re.findall(r"null,\s*'([^']+)", ptext, re.S)[0] pf = re.compile(r"[a-zA-Z]{1,}").split(pf) passphrase = ''.join([chr(int(c)) for c in pf]) passphrase = re.findall(r'var\s+pass\s*=\s*"([^"]+)', passphrase)[0] from resources.lib.jscrypto import jscrypto etext = jscrypto.decode(ct, passphrase, salt) ctext = jsunpack.unpack(etext).replace('\\', '') frames = re.findall(r'sources:\s*(\[[^]]+\])', ctext)[0] frames = re.findall(r'file":"([^"]+)[^}]+label":"(\d+p)"', frames) t = int(time.time() * 1000) sources = { qual: "{0}{1}&ref={2}&res={3}".format(source, t, site.url, qual) for source, qual in frames } surl = utils.prefquality(sources) if surl: if surl.startswith('//'): surl = 'https:' + surl vp.play_from_direct_link(surl) vp.progress.close() return elif 'motonews' in videourl: if videourl.startswith('//'): videourl = 'https:' + videourl epage = utils.getHtml(videourl, url) s = re.findall(r'file":"(?P<url>[^"]+)","label":"(?P<label>[^"]+)', epage) if s: sources = {qual: source.replace('\\/', '/') for source, qual in s} surl = utils.prefquality(sources) if surl.startswith('//'): surl = 'https:' + surl vp.play_from_direct_link(surl + '|Referer={0}&verifypeer=false'.format( urllib_parse.urljoin(videourl, '/'))) else: vp.progress.close() utils.notify('Oh oh', 'No video found') return else: vp.play_from_link_to_resolve(videourl)
def get_videos(self, url): videos = [] if 'cinebix.com' in url: self.resolve_media(url, videos) return videos html = requests.get(url, headers=self.hdr).text try: linkcode = jsunpack.unpack(html).replace('\\', '') sources = json.loads(re.findall('sources:(.*?)\}\)', linkcode)[0]) for source in sources: url = source['file'] + '|Referer=http://%s/' % self.get_vidhost( source['file']) url = urllib.quote_plus(url) videos.append(('tamilgun | %s' % source['label'], url)) except: pass try: sources = json.loads( re.findall('(?s)sources:\s*(.*?)\}\)', html)[0]) #ua = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' for source in sources: url = source['file'] if 'play.php' in url: #url += '|Referer=http://%s/'%self.get_vidhost(url) url = urllib.quote_plus(url) videos.append(('tamilgun | %s' % source['label'], url)) else: url += '|User-Agent=%s' % self.hdr['User-Agent'] url = urllib.quote_plus(url) videos.append(('tamilgun live', url)) except: pass mlink = SoupStrainer('div', {'id': 'videoframe'}) videoclass = BeautifulSoup(html, parseOnlyThese=mlink) try: links = videoclass.findAll('iframe') for link in links: url = link.get('src') if 'http' not in url: url = 'http:' + url self.resolve_media(url, videos) except: pass mlink = SoupStrainer('div', {'class': 'entry-excerpt'}) videoclass = BeautifulSoup(html, parseOnlyThese=mlink) try: links = videoclass.findAll('iframe') for link in links: if 'http' in str(link): url = link.get('src') self.resolve_media(url, videos) except: pass try: links = videoclass.findAll('p') for link in links: if 'http' in str(link): url = link.a.get('href') self.resolve_media(url, videos) except: pass try: sources = json.loads(re.findall('vdf-data-json">(.*?)<', html)[0]) url = 'https://www.youtube.com/watch?v=%s' % sources['videos'][0][ 'youtubeID'] self.resolve_media(url, videos) except: pass return videos
def getTVm3u(url): sess.headers.update({ 'User-Agent': UA, 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'Referer': 'https://hejo.tv/', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', }) try: html = getUrl(url) unpack = '' htmlsy = re.findall('script.defer(.+?)$', html, re.DOTALL) # [0] htmlsy = htmlsy[0] if htmlsy else html pack3 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?\)\)\))') results = pack3.findall(htmlsy) # [0] for result in results: unpack += jsunpack.unpack(result) packer2 = re.compile('(eval\(function\(p,a,c,k,e,d\).+?{}\)\))') results = packer2.findall(htmlsy) # [0] for result in results: unpack += jsunpack.unpack(result) unpack = unpack.replace("\\\'", '"') if 'setCookie' in unpack: zalogujponownie() getTVm3u(url) api = re.findall('.get\("([^"]+)",function\(c\)', unpack)[0] nxturl = parseDOM(html, 'iframe', attrs={ 'name': "livetv", "src": ".+?"}, ret='src')[0] api = 'https://hejo.tv'+api if api.startswith('/') else api chTbl = [] headers2 = { 'User-Agent': UA, 'Accept': '*/*', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive', 'Referer': url, 'TE': 'Trailers', } chTbl = sess.get(api, cookies=sess.cookies, headers=headers2, verify=False).json() headers = { 'User-Agent': UA, 'Accept': '*/*', 'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'Referer': url, 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive', 'TE': 'Trailers', } html = sess.get(nxturl, cookies=sess.cookies, headers=headers, verify=False) ref = html.url html = html.content.decode(encoding='utf-8', errors='strict') stream_url = re.findall("hls.loadSource\('(.+?)'\)", html)[0] pol = sess.get(stream_url, cookies=sess.cookies, headers=headers, verify=False).content.decode(encoding='utf-8', errors='strict') jakoscstream_url = re.findall( 'RESOLUTION=(.+?)\\r\\n(htt.+?)\\r', pol, re.DOTALL) if jakoscstream_url: if jakosc == 'auto': stream_url = jakoscstream_url[0][1] else: try: for jak, href in jakoscstream_url: if jakosc == jak: stream_url = href else: continue except: stream_url = jakoscstream_url[0][1] streamy = stream_url+'|Referer='+ref else: streamy = '' # stream_url+'|Referer='+ref except Exception as e: sel = xbmcgui.Dialog().ok( '[COLOR red]Problem[/COLOR]', 'Tylko konta premium :-(') streamy = '' return streamy
def player(name, url, iconimage): OK = True mensagemprogresso = xbmcgui.DialogProgress() mensagemprogresso.create('HORA DA PIPOCA', 'Obtendo Fontes para ' + name, 'Por favor aguarde...') mensagemprogresso.update(0) titsT = [] idsT = [] matriz = [] link = openURL(url) soup = BeautifulSoup(link) try: conteudo = soup("div", {"class": "pn-opcoes pn-dub"}) srvsdub = conteudo[0]("li") totD = len(srvsdub) tipo = "Dublado" for i in range(totD): t**S = srvsdub[i].text.encode('utf-8', 'ignore') + " (%s)" % tipo if not 'Principal' in t**S: if not 'DropVideo' in t**S: if not 'Vídeo PW' in t**S: if not 'YouWatch' in t**S: if not 'Youwatch' in t**S: if not 'NeoDrive' in t**S: idS = srvsdub[i]["data-pid"] titsT.append(t**S) idsT.append(idS) except: pass try: conteudo = soup("div", {"class": "pn-opcoes pn-leg"}) srvsleg = conteudo[0]("li") totL = len(srvsleg) tipo = "Legendado" for i in range(totL): t**S = srvsleg[i].text.encode('utf-8', 'ignore') + " (%s)" % tipo if not 'Principal' in t**S: if not 'DropVideo' in t**S: if not 'Vídeo PW' in t**S: if not 'YouWatch' in t**S: if not 'Youwatch' in t**S: if not 'NeoDrive' in t**S: idS = srvsleg[i]["data-pid"] titsT.append(t**S) idsT.append(idS) except: pass if not titsT: return index = xbmcgui.Dialog().select('Selecione uma das fontes suportadas :', titsT) if index == -1: return ind = idsT[index] conteudo = soup("li", {"class": "pi-item" + ind}) links = conteudo[0]("iframe") if len(links) == 0: links = conteudo[0]("embed") for link in links: urlVideo = link["data-src"] print "URLVIDEO " + urlVideo mensagemprogresso.update(50, 'Resolvendo fonte para ' + name, 'Por favor aguarde...') if 'nowvideo.php' in urlVideo: nowID = urlVideo.split("id=")[1] urlVideo = 'http://embed.nowvideo.sx/embed.php?v=%s' % nowID elif 'video.tt' in urlVideo: vttID = urlVideo.split('e/')[1] urlVideo = 'http://www.video.tt/watch_video.php?v=%s' % vttID elif 'flashx.php' in urlVideo: fxID = urlVideo.split('id=')[1] urlVideo = 'http://www.flashx.tv/embed-%s.html' % fxID elif 'thevid.net' in urlVideo: linkTV = openURL(urlVideo) js_data = jsunpack.unpack(linkTV) url2Play = re.findall('var vurl2="(.*?)"', js_data)[0] OK = False if OK: url2Play = urlresolver.resolve(urlVideo) if not url2Play: return legendas = '-' mensagemprogresso.update(75, 'Abrindo Sinal para ' + name, 'Por favor aguarde...') playlist = xbmc.PlayList(1) playlist.clear() listitem = xbmcgui.ListItem(name, thumbnailImage=iconimage) listitem.setPath(url2Play) listitem.setProperty('mimetype', 'video/mp4') listitem.setProperty('IsPlayable', 'true') playlist.add(url2Play, listitem) xbmcPlayer = xbmc.Player(xbmc.PLAYER_CORE_AUTO) xbmcPlayer.play(playlist) mensagemprogresso.update(100) mensagemprogresso.close() if legendas != '-': if 'timedtext' in legendas: import os.path sfile = os.path.join(xbmc.translatePath("special://temp"), 'sub.srt') sfile_xml = os.path.join(xbmc.translatePath("special://temp"), 'sub.xml') #timedtext sub_file_xml = open(sfile_xml, 'w') sub_file_xml.write(urllib2.urlopen(legendas).read()) sub_file_xml.close() xmltosrt.main(sfile_xml) xbmcPlayer.setSubtitles(sfile) else: xbmcPlayer.setSubtitles(legendas)