Beispiel #1
0
def gamato_links(url, name, poster):  #12
    try:
        data = client.request(url)
        desc = client.parseDOM(data, 'div', attrs={'itemprop':
                                                   'description'})[0]
        desc = re.sub('<.+?>', '', desc)
        desc = desc.encode('utf-8', 'ignore')
        try:
            match = re.findall(
                '''file\s*:\s*['"](.+?)['"],poster\s*:\s*['"](.+?)['"]\}''',
                data, re.DOTALL)[0]
            link, _poster = match[0], match[1]
        except IndexError:
            frame = client.parseDOM(data, 'div', attrs={'id': 'option-\d+'})[0]
            frame = client.parseDOM(frame, 'iframe', ret='src')[0]
            if 'cloud' in frame:
                #sources: ["http://cloudb.me/4fogdt6l4qprgjzd2j6hymoifdsky3tfskthk76ewqbtgq4aml3ior7bdjda/v.mp4"],
                match = client.request(frame)
                try:
                    from resources.lib.modules import jsunpack
                    if jsunpack.detect(match):
                        match = jsunpack.unpack(match)
                    match = re.findall('sources:\s*\[[\'"](.+?)[\'"]\]', match,
                                       re.DOTALL)[0]
                    match += '|User-Agent=%s&Referer=%s' % (urllib.quote(
                        client.agent()), frame)
                except IndexError:
                    from resources.lib.modules import jsunpack as jsun
                    if jsun.detect(match):
                        match = jsun.unpack(match)
                        match = re.findall('sources:\s*\[[\'"](.+?)[\'"]\]',
                                           match, re.DOTALL)[0]
                        match += '|User-Agent=%s&Referer=%s' % (urllib.quote(
                            client.agent()), frame)

            else:
                match = frame
            link, _poster = match, poster

        try:
            fanart = client.parseDOM(data, 'div', attrs={'class': 'g-item'})[0]
            fanart = client.parseDOM(fanart, 'a', ret='href')[0]
        except IndexError:
            fanart = FANART
        try:
            trailer = client.parseDOM(data, 'iframe', ret='src')
            trailer = [i for i in trailer if 'youtube' in i][0]
            addDir('[B][COLOR lime]Trailer[/COLOR][/B]', trailer, 100,
                   iconimage, fanart, str(desc))
        except BaseException:
            pass

        addDir(name, link, 100, poster, fanart, str(desc))
    except BaseException:
        return
    views.selectView('movies', 'movie-view')
Beispiel #2
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            for movielink, referer in self.url:
                try:
                    # print("CMOVIES SOURCE LINKS", movielink)
                    if len(sources) > 2: break
                    referer = referer
                    pages = client.request(movielink, timeout='3')
                    scripts = re.findall('<script src="(.*?)">', pages)
                    # print("CMOVIES SERVER SCRIPT", scripts)
                    for items in scripts:
                        if "slug=" in items:
                            if len(sources) > 2: break
                            headers = {
                                'User-Agent':
                                'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
                            }
                            result = s.get(items, headers=headers,
                                           timeout=3).content
                            if jsunpack.detect(result):
                                js_data = jsunpack.unpack(result)
                                match = re.search(
                                    '"sourcesPlaylist"\s*:\s*"([^"]+)',
                                    js_data)
                                video_url = match.group(1).replace('\\', '')
                                headers = {
                                    'User-Agent':
                                    'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
                                }
                                streams = s.get(video_url,
                                                headers=headers,
                                                timeout=3).json()
                                # print("CMOVIES FOUND PLAYLIST UNPACKED", streams)
                                playurl = streams['playlist'][0]['sources']
                                for results in playurl:
                                    url = results['file']
                                    quality = results['label']
                                    if "1080" in quality: quality = "1080p"
                                    elif "720" in quality: quality = "HD"
                                    else: quality = "SD"
                                    url = url.encode('utf-8')
                                    if "google" in url:
                                        print("CMOVIES PLAYABLE LINKS", url,
                                              quality)
                                        sources.append({
                                            'source': 'gvideo',
                                            'quality': quality,
                                            'provider': 'Watch5s',
                                            'url': url,
                                            'direct': True,
                                            'debridonly': False
                                        })

                except:
                    pass
            return sources
        except:
            return sources
Beispiel #3
0
 def unpacked(self, url):
     try:
         unpacked = ''
         html = client.request(url,
                               headers=client.randommobileagent('android'),
                               timeout='3')
         if jsunpack.detect(html):
             unpacked = jsunpack.unpack(html)
         return unpacked
     except:
         return
Beispiel #4
0
def unpacked(url):
    try:
        from resources.lib.modules import client
        from resources.lib.modules import jsunpack
        from resources.lib.modules import log_utils
        unpacked = ''
        html = client.request(url)
        if jsunpack.detect(html):
            unpacked = jsunpack.unpack(html)
            #log_utils.log('WatchWrestling - unpacked: \n' + str(unpacked))
        else:
            log_utils.log('getSum - unpacked - Failed.')
        return unpacked
    except:
        return
    def sources(self, url, hostDict, hostprDict):
        try:
			sources = []
			for movielink,referer in self.url:
				try:
					# print("CMOVIES SOURCE LINKS", movielink)
					if len(sources) > 2: break
					referer = referer
					pages = client.request(movielink, timeout='3')
					scripts = re.findall('<script src="(.*?)">', pages)
					# print("CMOVIES SERVER SCRIPT", scripts)
					for items in scripts:
						if "slug=" in items:
							if len(sources) > 2: break
							headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'}
							result = s.get(items, headers=headers, timeout=3).content
							if jsunpack.detect(result):
								js_data = jsunpack.unpack(result)
								match = re.search('"sourcesPlaylist"\s*:\s*"([^"]+)', js_data)
								video_url = match.group(1).replace('\\','')								
								headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'}
								streams = s.get(video_url, headers=headers, timeout=3).json()			
								# print("CMOVIES FOUND PLAYLIST UNPACKED", streams)
								playurl  = streams['playlist'][0]['sources']
								for results in playurl:	
									url = results['file']
									quality = results['label']
									if "1080" in quality: quality = "1080p"
									elif "720" in quality: quality = "HD"
									else: quality = "SD"
									url = url.encode('utf-8')
									if "google" in url:
										print("CMOVIES PLAYABLE LINKS", url, quality)
										sources.append({'source': 'gvideo', 'quality': quality, 'provider': 'Watch5s', 'url': url, 'direct': True, 'debridonly': False})

				except:
					pass
			return sources
        except:
            return sources
Beispiel #6
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:
            if not url:
                return sources

            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)
            r = dom_parser.parse_dom(r, 'div', {'class': 'repro'})

            r = dom_parser.parse_dom(r[0].content, 'iframe', req='src')
            f = r[0].attrs['src']

            r = client.request(f)
            r = dom_parser.parse_dom(r, 'div', {'id': 'botones'})
            r = dom_parser.parse_dom(r, 'a', req='href')
            r = [(i.attrs['href'], urlparse.urlparse(i.attrs['href']).netloc)
                 for i in r]

            links = []

            for u, h in r:
                if not 'pelispedia' in h:
                    valid, host = source_utils.is_host_valid(u, hostDict)
                    if not valid: continue

                    links.append({
                        'source': host,
                        'quality': 'SD',
                        'url': u,
                        'direct': False
                    })
                    continue

                result = client.request(u,
                                        headers={'Referer': f},
                                        timeout='10')

                try:
                    if 'pelispedia' in h: raise Exception()

                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall(
                        'file\s*:\s*(?:\"|\')(.+?)(?:\"|\')\s*,\s*label\s*:\s*(?:\"|\')(.+?)(?:\"|\')',
                        url)
                    url = [i[0] for i in url if '720' in i[1]][0]

                    links.append({
                        'source': 'cdn',
                        'quality': 'HD',
                        'url': url,
                        'direct': False
                    })
                except:
                    pass

                try:
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)

                    for i in url:
                        try:
                            links.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'url':
                                i,
                                'direct':
                                True
                            })
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('gkpluginsphp.*?link\s*:\s*"([^"]+)',
                                      result)[0]
                    post = urllib.urlencode({'link': post})

                    url = urlparse.urljoin(
                        self.base_link, '/gkphp_flv/plugins/gkpluginsphp.php')
                    url = client.request(url,
                                         post=post,
                                         XHR=True,
                                         referer=u,
                                         timeout='10')
                    url = json.loads(url)['link']

                    links.append({
                        'source': 'gvideo',
                        'quality': 'HD',
                        'url': url,
                        'direct': True
                    })
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)',
                                      result)[0]

                    post = urlparse.parse_qs(
                        urlparse.urlparse(post).query)['pic'][0]
                    post = urllib.urlencode({
                        'sou': 'pic',
                        'fv': '25',
                        'url': post
                    })

                    url = client.request(self.protect_link,
                                         post=post,
                                         XHR=True,
                                         timeout='10')
                    url = json.loads(url)[0]['url']

                    links.append({
                        'source': 'cdn',
                        'quality': 'HD',
                        'url': url,
                        'direct': True
                    })
                except:
                    pass

                try:
                    if not jsunpack.detect(result): raise Exception()

                    result = jsunpack.unpack(result)
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*.*?\'(.+?)\'', url)
                    for i in url:
                        try:
                            i = client.request(i,
                                               headers={'Referer': f},
                                               output='geturl',
                                               timeout='10')
                            links.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'url':
                                i,
                                'direct':
                                True
                            })
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)',
                                      result)[0]

                    post = urlparse.parse_qs(
                        urlparse.urlparse(post).query)['pic'][0]
                    token = 'eyJjdCI6InZGS3QySm9KRWRwU0k4SzZoZHZKL2c9PSIsIml2IjoiNDRkNmMwMWE0ZjVkODk4YThlYmE2MzU0NDliYzQ5YWEiLCJzIjoiNWU4MGUwN2UwMjMxNDYxOCJ9'
                    post = urllib.urlencode({
                        'sou': 'pic',
                        'fv': '0',
                        'url': post,
                        'token': token
                    })

                    url = client.request(self.protect_link,
                                         post=post,
                                         XHR=True,
                                         timeout='10')
                    js = json.loads(url)
                    url = [i['url'] for i in js]
                    for i in url:
                        try:
                            i = client.request(i,
                                               headers={'Referer': f},
                                               output='geturl',
                                               timeout='10')
                            links.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'url':
                                i,
                                'direct':
                                True
                            })
                        except:
                            pass
                except:
                    pass

            for i in links:
                sources.append({
                    'source': i['source'],
                    'quality': i['quality'],
                    'language': 'en',
                    'url': i['url'],
                    'direct': i['direct'],
                    'debridonly': False
                })

            return sources
        except:
            return sources
def gamato_links(url, name, poster):  # 12
    try:
        url = urllib.quote(url, ':/.')
        data = requests.get(url).text
        # xbmc.log('DATA: {}'.format(str(data)))
        try:
            desc = client.parseDOM(data,
                                   'div',
                                   attrs={'itemprop': 'description'})[0]
            desc = clear_Title(desc)
        except IndexError:
            desc = 'N/A'

        try:
            # Playerjs({id:"playerjs14892",file:"https://gamato1.com/s/Aladdin%20and%20the%20King%20of%20Thieves%201996.mp4"})
            link = re.findall(r'''Playerjs\(\{.+?file\s*:\s*['"](.+?)['"]\}''',
                              data, re.DOTALL)[0]
            link = urllib.quote(link, ':/.')
            link += '|User-Agent={}&Referer={}'.format(
                urllib.quote(client.agent()), urllib.quote(url))
            # xbmc.log('FRAME: {}'.format(link))
        except IndexError:
            try:
                match = re.findall(
                    r'''file\s*:\s*['"](.+?)['"],poster\s*:\s*['"](.+?)['"]\}''',
                    data, re.DOTALL)[0]
                link, _poster = match[0], match[1]
                # xbmc.log('FRAME: {} | Poster {}'.format(link, _poster))
            except IndexError:
                frame = client.parseDOM(data,
                                        'div',
                                        attrs={'id': r'option-\d+'})[0]
                frame = client.parseDOM(frame, 'iframe', ret='src')[0]
                # xbmc.log('FRAME: {}'.format(frame))

                if 'cloud' in frame:
                    # sources: ["http://cloudb.me/4fogdt6l4qprgjzd2j6hymoifdsky3tfskthk76ewqbtgq4aml3ior7bdjda/v.mp4"],
                    match = client.request(frame)
                    try:
                        from resources.lib.modules import jsunpack
                        if jsunpack.detect(match):
                            match = jsunpack.unpack(match)
                        match = re.findall(r'sources:\s*\[[\'"](.+?)[\'"]\]',
                                           match, re.DOTALL)[0]
                        match += '|User-Agent=%s&Referer=%s' % (urllib.quote(
                            client.agent()), frame)
                    except IndexError:
                        from resources.lib.modules import jsunpack as jsun
                        if jsun.detect(match):
                            match = jsun.unpack(match)
                            match = re.findall(
                                r'sources:\s*\[[\'"](.+?)[\'"]\]', match,
                                re.DOTALL)[0]
                            match += '|User-Agent=%s&Referer=%s' % (
                                urllib.quote(client.agent()), frame)
                else:
                    match = frame
                link, _poster = match, poster

        try:
            fanart = client.parseDOM(data, 'div', attrs={'class': 'g-item'})[0]
            fanart = client.parseDOM(fanart, 'a', ret='href')[0]
        except IndexError:
            fanart = FANART
        try:
            trailer = client.parseDOM(data, 'iframe', ret='src')
            trailer = [i for i in trailer if 'youtube' in i][0]
            addDir('[B][COLOR lime]Trailer[/COLOR][/B]', trailer, 100,
                   iconimage, fanart, str(desc))
        except IndexError:
            pass

        addDir(name, link, 100, poster, fanart, str(desc))
    except BaseException:
        return
    views.selectView('movies', 'movie-view')
def evaluate(host):
    try:
        #xbmc.log('@#@HOST:%s' % host, xbmc.LOGNOTICE)
        if 'animeshd' in host:
            host = client.request(host, output='geturl')

        elif 'server.pelisplus' in host:
            host = client.request(host)
            host = client.parseDOM(host, 'iframe', ret='src')[0]

        else:
            host = host
        #xbmc.log('@#@HOST-FINAL:%s' % host, xbmc.LOGNOTICE)
        if 'openload' in host:
            try:
                from resources.lib.modules import openload
                oplink = openload.get_video_openload(host)
                host = resolveurl.resolve(oplink) if oplink == '' else oplink
            except BaseException:
                host = resolveurl.resolve(host)
            return host

        elif 'animehdpro' in host:
            data = client.request(host)
            host = re.compile('''file['"]:['"]([^'"]+)''',
                              re.DOTALL).findall(data)[0]
            host = requests.get(host).headers['location']
            #xbmc.log('@#@ANIMEHDPRO:%s' % host, xbmc.LOGNOTICE)
            return host + '|User-Agent=%s' % urllib.quote(client.agent())

        elif 'tiwi' in host:
            from resources.lib.modules import jsunpack
            data = client.request(host)
            if jsunpack.detect(data):
                data = jsunpack.unpack(data)
                link = re.compile('''\{file:['"]([^'"]+)''',
                                  re.DOTALL).findall(data)[0]
                #xbmc.log('@#@HDPRO:%s' % link, xbmc.LOGNOTICE)
            else:
                #link = re.compile('''video\/mp4.+?src:['"](.+?)['"]''', re.DOTALL).findall(data)[0]
                link = re.compile('''dash\+xml.+?src:['"](.+?)['"]''',
                                  re.DOTALL).findall(data)[0]
                #xbmc.log('@#@HDPRO:%s' % link, xbmc.LOGNOTICE)
            return link + '|User-Agent=%s&Referer=%s' % (urllib.quote(
                client.agent()), host)

        elif 'pelishd.tv' in host:
            res_quality = []
            stream_url = []
            from resources.lib.modules import unjuice
            import json
            data = client.request(host)
            if unjuice.test(data):
                juice = unjuice.run(data)
                links = json.loads(re.findall('sources:(\[.+?\])', juice)[0])
                for stream in links:
                    url = stream['file']
                    qual = '[COLORlime][B]%s Calidad[/B][/COLOR]' % stream[
                        'label']
                    res_quality.append(qual)
                    stream_url.append(url)
                if len(res_quality) > 1:
                    dialog = xbmcgui.Dialog()
                    ret = dialog.select('[COLORgold][B]Ver en[/B][/COLOR]',
                                        res_quality)
                    if ret == -1:
                        return
                    elif ret > -1:
                        host = stream_url[ret]
                        #xbmc.log('@#@HDPRO:%s' % host, xbmc.LOGNOTICE)
                        return host + '|User-Agent=%s' % urllib.quote(
                            client.agent())
                    else:
                        return
                else:
                    host = stream_url[0]
                    return host + '|User-Agent=%s' % urllib.quote(
                        client.agent())

        elif 'www.pelisplus.net' in host:
            res_quality = []
            stream_url = []

            headers = {'User-Agent': client.agent(), 'Referer': host}
            cj = requests.get(host, headers=headers).cookies
            cj = '__cfduid=%s' % str(cj['__cfduid'])
            vid_id = host.split('/')[-1]
            headers['Cookie'] = cj
            data = requests.post('https://www.pelisplus.net/api/source/%s' %
                                 vid_id,
                                 headers=headers).json()
            streams = data['data']
            for stream in streams:
                url = stream['file']
                url = 'https://www.pelisplus.net' + url if url.startswith(
                    '/') else url
                qual = '[COLORlime][B]%s Calidad[/B][/COLOR]' % stream['label']
                res_quality.append(qual)
                stream_url.append(url)
            if len(res_quality) > 1:
                dialog = xbmcgui.Dialog()
                ret = dialog.select('[COLORgold][B]Ver en[/B][/COLOR]',
                                    res_quality)
                if ret == -1:
                    return
                elif ret > -1:
                    host = stream_url[ret]
                    #xbmc.log('@#@HDPRO:%s' % host, xbmc.LOGNOTICE)
                    return host + '|User-Agent=%s' % urllib.quote(
                        client.agent())
                else:
                    return

            else:
                host = stream_url[0]
                return host + '|User-Agent=%s' % urllib.quote(client.agent())

        else:
            host = resolveurl.resolve(host)
            return host
    except:
        return host
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            r = urlparse.urljoin(self.base_link, url)

            result = client.request(r, timeout='10')

            f = client.parseDOM(result, 'iframe', ret='src')
            f = [i for i in f if 'iframe' in i][0]

            result = client.request(f, headers={'Referer': r}, timeout='10')

            r = client.parseDOM(result, 'div', attrs = {'id': 'botones'})[0]
            r = client.parseDOM(r, 'a', ret='href')
            r = [(i, urlparse.urlparse(i).netloc) for i in r]

            links = []

            for u, h in r:
                if not 'pelispedia' in h: continue

                result = client.request(u, headers={'Referer': f}, timeout='10')

                try:
                    if 'pelispedia' in h: raise Exception()

                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')\s*,\s*label\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)
                    url = [i[0] for i in url if '720' in i[1]][0]

                    links.append({'source': 'cdn', 'quality': 'HD', 'url': url, 'direct': False})
                except:
                    pass

                try:
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)

                    for i in url:
                        try:
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i, 'direct': True})
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('gkpluginsphp.*?link\s*:\s*"([^"]+)', result)[0]
                    post = urllib.urlencode({'link': post})

                    url = urlparse.urljoin(self.base_link, '/gkphp_flv/plugins/gkpluginsphp.php')
                    url = client.request(url, post=post, XHR=True, referer=u, timeout='10')
                    url = json.loads(url)['link']

                    links.append({'source': 'gvideo', 'quality': 'HD', 'url': url, 'direct': True})
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)', result)[0]

                    post = urlparse.parse_qs(urlparse.urlparse(post).query)['pic'][0]
                    post = urllib.urlencode({'sou': 'pic', 'fv': '23', 'url': post})

                    url = urlparse.urljoin(self.base_link, '/Pe_Player_Html5/pk/pk_2/plugins/protected.php')
                    url = client.request(url, post=post, XHR=True, timeout='10')
                    url = json.loads(url)[0]['url']

                    links.append({'source': 'cdn', 'quality': 'HD', 'url': url, 'direct': True})
                except:
                    pass

                try:
                    if not jsunpack.detect(result): raise Exception()

                    result = jsunpack.unpack(result)
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*.*?\'(.+?)\'', url)
                    for i in url:
                        try:
                            i = client.request(i, headers={'Referer': f}, output='geturl', timeout='10')
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i,
                                          'direct': True})
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)', result)[0]

                    post = urlparse.parse_qs(urlparse.urlparse(post).query)['pic'][0]
                    token = 'eyJjdCI6InZGS3QySm9KRWRwU0k4SzZoZHZKL2c9PSIsIml2IjoiNDRkNmMwMWE0ZjVkODk4YThlYmE2MzU0NDliYzQ5YWEiLCJzIjoiNWU4MGUwN2UwMjMxNDYxOCJ9'
                    post = urllib.urlencode({'sou': 'pic', 'fv': '0', 'url': post, 'token': token})

                    url = urlparse.urljoin(self.player_link, '/template/protected.php')
                    url = client.request(url, post=post, XHR=True, timeout='10')
                    js = json.loads(url)
                    url = [i['url'] for i in js]
                    for i in url:
                        try:
                            i = client.request(i, headers={'Referer': f}, output='geturl', timeout='10')
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i,
                                          'direct': True})
                        except:
                            pass
                except:
                    pass

            for i in links: sources.append({'source': i['source'], 'quality': i['quality'], 'language': 'en', 'url': i['url'], 'direct': i['direct'], 'debridonly': False})

            return sources
        except:
            return sources
Beispiel #10
0
def PLAY_URL(name,url,iconimage):

    name,url,iconimage = url.split('|SPLIT|')
    name = name.replace('[COLOR white]','').replace('[/COLOR]','').replace(' - ','')
    ref_url = url
    dp = common.GET_LUCKY()
    try:
        result = common.open_url(url).replace('/n','')
    except:
        dialog.ok(AddonTitle, "Error connecting to website. Please try again.")
        quit()

    theid = re.findall('playvideo.php\?id=([^"]+)\"',result)[0]
    r   = urlparse.urljoin(BASE_LINK, '/jwplayer/playvideo.php?id=' + theid)
    r = common.open_url(r)

    if jsunpack.detect(r):   
        unpacked = jsunpack.unpack(r)
        url = re.findall('file:\"(.+?)\"',unpacked)[0]
    
    choice = dialog.select("[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Watch Video[/COLOR]','[COLOR pink]Add to Favourites[/COLOR]','[COLOR pink]Download Video[/COLOR]'])

    if choice == 1:
        a=open(FAVOURITES_FILE).read()
        b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>OverThumbs</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
        f= open(FAVOURITES_FILE, mode='w')
        f.write(str(b))
        f.close()
        dp.close()
        dialog.ok(AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]")
        quit()
    
    elif choice == 2:
        try:
            download_location   = plugintools.get_setting("download_location")
            download_folder = xbmc.translatePath(download_location)
            _in = url
            name = name.replace(' ','_').replace('[COLOR','').replace('[/COLOR','').replace('[I]','').replace(']','').replace('|','').replace('%','').replace('-','').replace('[/I','').replace('[/B','').replace('[','').replace('/','').replace(':','')
            _out = download_folder + name + '.mp4'
            dp.close()
            a=open(DOWNLOADS_FILE).read()
            b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(_out)+'</name>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
            f= open(DOWNLOADS_FILE, mode='w')
            f.write(str(b))
            f.close()
            downloader.download(_in,_out,dp=None)
            dialog.ok(AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]") 
        except: 
            try:
                os.remove(_out)
            except: pass
            dp.close()
            dialog.ok(AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]")
            quit()
    
    elif choice == 0:
        history_on_off  = plugintools.get_setting("history_setting")
        if history_on_off == "true":
            date_now = datetime.datetime.now().strftime("%d-%m-%Y")
            time_now = datetime.datetime.now().strftime("%H:%M")
            a=open(HISTORY_FILE).read()
            b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<date>'+str(date_now)+'</date>\n<time>'+str(time_now)+'</time>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>OverThumbs</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
            f= open(HISTORY_FILE, mode='w')
            f.write(str(b))
            f.close()

        url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
        dp.close()
        xbmc.Player ().play(url, liz, False)
        quit()
    else:
        dp.close()
        quit()
Beispiel #11
0
def evaluate(host):
    try:
        if 'animeshd' in host:
            host = client.request(host, output='geturl')

        else:
            host = host
        xbmc.log('@#@HOST:%s' % host, xbmc.LOGNOTICE)
        if 'openload' in host:
            from resources.lib.modules import openload
            if openload.test_video(host):
                host = openload.get_video_openload(host)
            else:
                host = resolveurl.resolve(host)
            return host

        elif 'animehdpro' in host:
            data = client.request(host)
            host = re.compile('''file['"]:['"]([^'"]+)''',
                              re.DOTALL).findall(data)[0]
            host = requests.get(host).headers['location']
            xbmc.log('@#@HDPRO:%s' % host, xbmc.LOGNOTICE)
            return host + '|User-Agent=%s' % urllib.quote(client.agent())

        elif 'tiwi' in host:
            from resources.lib.modules import jsunpack
            data = client.request(host)
            if jsunpack.detect(data):
                data = jsunpack.unpack(data)
                link = re.compile('''\{file:['"]([^'"]+)''',
                                  re.DOTALL).findall(data)[0]
                xbmc.log('@#@HDPRO:%s' % link, xbmc.LOGNOTICE)
            else:
                link = re.compile('''dash\+xml.+?src:['"](.+?)['"]''',
                                  re.DOTALL).findall(data)[0]
                xbmc.log('@#@HDPRO:%s' % link, xbmc.LOGNOTICE)
            return link + '|User-Agent=%s&Referer=%s' % (urllib.quote(
                client.agent()), host)

        elif 'www.pelisplus.net' in host:
            res_quality = []
            stream_url = []

            headers = {'User-Agent': client.agent(), 'Referer': host}
            cj = requests.get(host, headers=headers).cookies
            cj = '__cfduid=%s' % str(cj['__cfduid'])
            vid_id = host.split('/')[-1]
            headers['Cookie'] = cj
            data = requests.post('https://www.pelisplus.net/api/sources/%s' %
                                 vid_id,
                                 headers=headers).json()
            streams = data['data']
            for stream in streams:
                url = stream['file']
                qual = stream['label']
                res_quality.append(qual)
                stream_url.append(url)
            if len(res_quality) > 1:
                dialog = xbmcgui.Dialog()
                ret = dialog.select('Ver en', res_quality)
                if ret == -1:
                    return
                elif ret > -1:
                    host = stream_url[ret]
                    xbmc.log('@#@HDPRO:%s' % host, xbmc.LOGNOTICE)
                    return host + '|User-Agent=%s' % urllib.quote(
                        client.agent())

        else:
            host = resolveurl.resolve(host)
            return host
    except:
        return host
Beispiel #12
0
def gamato_links(url, name, poster):  # 12
    try:
        url = quote(url, ':/.')
        data = requests.get(url).text
        # xbmc.log('DATA: {}'.format(str(data)))
        try:
            desc = client.parseDOM(data,
                                   'div',
                                   attrs={'itemprop': 'description'})[0]
            desc = clear_Title(desc)
        except IndexError:
            desc = 'N/A'

        try:
            # Playerjs({id:"playerjs14892",file:"https://gamato1.com/s/Aladdin%20and%20the%20King%20of%20Thieves%201996.mp4"})
            link = re.findall(
                r'''Playerjs\(\{.+?file\s*:\s*['"](.+?\.mp4)['"]\}''', data,
                re.DOTALL)[0]
            link = quote(link, ':/.')
            # link += '|User-Agent={}&Referer={}'.format(quote(client.agent()), quote(url))
            # xbmc.log('FRAME1: {}'.format(link))
        except IndexError:
            try:
                try:
                    match = re.findall(
                        r'''file\s*:\s*['"](.+?)['"],poster\s*:\s*['"](.+?)['"]\}''',
                        data, re.DOTALL)[0]
                    link, _poster = match[0], match[1]
                except IndexError:
                    # 'http://gamatotv2.com/kids/jwplayer/?source=http%3A%2F%2F161.97.109.217%2FSonic%2520%2520%2520-%2520Gamato%2520%2520.mp4&id=16449&type=mp4
                    link = re.findall(r'''/jwplayer/.+source=(.+?)&id=''',
                                      data, re.DOTALL)[0]

                # xbmc.log('FRAME2: {}'.format(link))
            except IndexError:
                frame = client.parseDOM(data,
                                        'div',
                                        attrs={'id': r'option-\d+'})[0]
                frame = client.parseDOM(frame, 'iframe', ret='src')[0]
                # xbmc.log('FRAME3: {}'.format(frame))

                if 'cloud' in frame:
                    # sources: ["http://cloudb.me/4fogdt6l4qprgjzd2j6hymoifdsky3tfskthk76ewqbtgq4aml3ior7bdjda/v.mp4"],
                    match = client.request(frame, referer=url)
                    # xbmc.log('MATCH3: {}'.format(match))
                    if 'meta name="robots"' in match:
                        cloudid = frame.split('html?')[-1].split('=')[0]
                        cloud = 'http://cloudb2.me/embed-{}.html?auto=1&referer={}'.format(
                            cloudid, url)
                        match = client.request(cloud)
                    try:
                        from resources.lib.modules import jsunpack
                        if jsunpack.detect(match):
                            match = jsunpack.unpack(match)
                        match = re.findall(r'sources:\s*\[[\'"](.+?)[\'"]\]',
                                           match, re.DOTALL)[0]
                        # match += '|User-Agent=%s&Referer=%s' % (quote(client.agent()), frame)
                    except IndexError:
                        from resources.lib.modules import jsunpack as jsun
                        if jsun.detect(match):
                            match = jsun.unpack(match)
                            match = re.findall(
                                r'sources:\s*\[[\'"](.+?)[\'"]\]', match,
                                re.DOTALL)[0]
                            # match += '|User-Agent=%s&Referer=%s' % (quote(client.agent()), frame)
                else:
                    match = frame
                link, _poster = match, poster

        try:
            fanart = client.parseDOM(data, 'div', attrs={'class': 'g-item'})[0]
            fanart = client.parseDOM(fanart, 'a', ret='href')[0]
        except IndexError:
            fanart = FANART
        try:
            trailer = client.parseDOM(data, 'iframe', ret='src')
            trailer = [i for i in trailer if 'youtube' in i][0]
            addDir('[B][COLOR lime]Trailer[/COLOR][/B]', trailer, 100,
                   iconimage, fanart, str(desc))
        except IndexError:
            pass

        addDir(name, link, 100, poster, fanart, str(desc))
    except BaseException:
        return
    views.selectView('movies', 'movie-view')
Beispiel #13
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            alt_links = []
            play_links = []
            link = client.request(url)
            film_quality = re.findall(
                '<div class="poster-qulabel">(.*?)</div>', link)[0]
            if "1080" in film_quality: quality = "1080p"
            elif "720" in film_quality: quality = "HD"
            else: quality = "SD"
            try:
                iframe = re.findall('<iframe src="([^"]+)"', link)[0]
                if iframe:
                    original_frame = iframe
                    # print ("MOVIEGO VIDEOURL", iframe)
                    videourl = client.request(iframe)

                    scripts_packs = re.compile('<script>(.+?)</script>',
                                               re.DOTALL).findall(videourl)
                    for pack in scripts_packs:
                        if jsunpack.detect(pack):
                            data_script = jsunpack.unpack(pack)
                            try:
                                alternative_links = re.findall(
                                    'Alternative (\d+)<', data_script)
                                for alts in alternative_links:
                                    alt_links.append(alts)
                            except:
                                pass
                            video_src = re.findall('<source src="([^"]+)"',
                                                   data_script)
                            # print ("MOVIEGO data_script", data_script)
                            for url in video_src:
                                url = url.replace(' ', '')
                                if "google" in url:
                                    play_links.append(url)
            except:
                pass
            try:
                for ids in alt_links:
                    newframes = original_frame + "?source=a" + ids
                    # print ("MOVIEGO NEW FRAMES", newframes)
                    newurl = client.request(newframes)
                    scripts_newpacks = re.compile('<script>(.+?)</script>',
                                                  re.DOTALL).findall(newurl)
                    for new_pack in scripts_newpacks:
                        if jsunpack.detect(new_pack):
                            new_data_script = jsunpack.unpack(new_pack)
                            new_video_src = re.findall('<source src="([^"]+)"',
                                                       new_data_script)
                            # print ("MOVIEGO ALT video_src", video_src)
                            for new_url in new_video_src:
                                new_url = new_url.replace(' ', '')
                                if "google" in new_url:
                                    play_links.append(new_url)
            except:
                pass

            try:
                dupes = []
                for url in play_links:
                    if not url in dupes:
                        dupes.append(url)
                        print("MOVIEGO PLAY url", url)
                        quality = directstream.googletag(url)[0]['quality']
                        url = client.replaceHTMLCodes(url)
                        url = url.encode('utf-8')
                        sources.append({
                            'source': 'gvideo',
                            'quality': quality,
                            'provider': 'Moviego',
                            'url': url,
                            'direct': True,
                            'debridonly': False
                        })
            except:
                pass

            try:
                url = re.findall('file:\s+"([^"]+)"', link)[0]
                sources.append({
                    'source': 'cdn',
                    'quality': quality,
                    'provider': 'Moviego',
                    'url': url,
                    'direct': True,
                    'debridonly': False
                })
            except:
                pass

            return sources
        except:
            return sources
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            r = urlparse.urljoin(self.base_link, url)

            result = client.request(r)

            f = client.parseDOM(result, 'iframe', ret='src')
            f = [i for i in f if 'iframe' in i][0]

            result = client.request(f, headers={'Referer': r})

            r = client.parseDOM(result, 'div', attrs={'id': 'botones'})[0]
            r = client.parseDOM(r, 'a', ret='href')
            r = [(i, urlparse.urlparse(i).netloc) for i in r]

            links = []

            for u, h in r:
                if not 'pelispedia' in h and not 'thevideos.tv' in h: continue

                result = client.request(u, headers={'Referer': f})

                try:
                    if 'pelispedia' in h: raise Exception()

                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall(
                        'file\s*:\s*(?:\"|\')(.+?)(?:\"|\')\s*,\s*label\s*:\s*(?:\"|\')(.+?)(?:\"|\')',
                        url)
                    url = [i[0] for i in url if '720' in i[1]][0]

                    links.append({
                        'source': 'cdn',
                        'quality': 'HD',
                        'url': url,
                        'direct': False
                    })
                except:
                    pass

                try:
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)

                    for i in url:
                        try:
                            links.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'url':
                                i,
                                'direct':
                                True
                            })
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('gkpluginsphp.*?link\s*:\s*"([^"]+)',
                                      result)[0]
                    post = urllib.urlencode({'link': post})

                    url = urlparse.urljoin(
                        self.base_link, '/Pe_flsh/plugins/gkpluginsphp.php')
                    url = client.request(url, post=post, XHR=True, referer=u)
                    url = json.loads(url)['link']

                    links.append({
                        'source': 'gvideo',
                        'quality': 'HD',
                        'url': url,
                        'direct': True
                    })
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)',
                                      result)[0]

                    post = urlparse.parse_qs(
                        urlparse.urlparse(post).query)['pic'][0]
                    post = urllib.urlencode({
                        'sou': 'pic',
                        'fv': '23',
                        'url': post
                    })

                    url = urlparse.urljoin(
                        self.base_link,
                        '/Pe_Player_Html5/pk/pk_2/plugins/protected.php')
                    url = client.request(url, post=post, XHR=True)
                    url = json.loads(url)[0]['url']

                    links.append({
                        'source': 'cdn',
                        'quality': 'HD',
                        'url': url,
                        'direct': True
                    })
                except:
                    pass

                try:
                    if not jsunpack.detect(result): raise Exception()

                    result = jsunpack.unpack(result)
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*.*?\'(.+?)\'', url)
                    for i in url:
                        try:
                            i = client.request(i,
                                               headers={'Referer': f},
                                               output='geturl')
                            links.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'url':
                                i,
                                'direct':
                                True
                            })
                        except:
                            pass
                except:
                    pass

            for i in links:
                sources.append({
                    'source': i['source'],
                    'quality': i['quality'],
                    'language': 'en',
                    'url': i['url'],
                    'direct': i['direct'],
                    'debridonly': False
                })

            return sources
        except:
            return sources
    def sources(self, url, hostDict, hostprDict):
        try:
			sources = []
			alt_links = []
			play_links = []
			link = client.request(url)
			film_quality = re.findall('<div class="poster-qulabel">(.*?)</div>',link)[0]
			if "1080" in film_quality: quality = "1080p"
			elif "720" in film_quality: quality = "HD"
			else: quality = "SD"
			try:
				iframe = re.findall('<iframe src="([^"]+)"',link)[0]
				if iframe:
					original_frame = iframe
					# print ("MOVIEGO VIDEOURL", iframe)
					videourl = client.request(iframe)
					
					scripts_packs = re.compile('<script>(.+?)</script>', re.DOTALL).findall(videourl)
					for pack in scripts_packs:
						if jsunpack.detect(pack):
							data_script = jsunpack.unpack(pack)
							try:
								alternative_links = re.findall('Alternative (\d+)<', data_script)
								for alts in alternative_links: alt_links.append(alts)
							except:
								pass
							video_src = re.findall('<source src="([^"]+)"', data_script)
							# print ("MOVIEGO data_script", data_script)
							for url in video_src:
								url = url.replace(' ', '')
								if "google" in url:
									play_links.append(url)
			except:
				pass
			try:
					for ids in alt_links:
						newframes = original_frame + "?source=a" + ids
						# print ("MOVIEGO NEW FRAMES", newframes)
						newurl = client.request(newframes)
						scripts_newpacks = re.compile('<script>(.+?)</script>', re.DOTALL).findall(newurl)
						for new_pack in scripts_newpacks:
							if jsunpack.detect(new_pack):
								new_data_script = jsunpack.unpack(new_pack)
								new_video_src = re.findall('<source src="([^"]+)"', new_data_script)
								# print ("MOVIEGO ALT video_src", video_src)
								for new_url in new_video_src:
									new_url = new_url.replace(' ', '')
									if "google" in new_url:
										play_links.append(new_url)
			except:
				pass
				
			try:
				dupes = []
				for url in play_links:
					if not url in dupes:
						dupes.append(url)
						print ("MOVIEGO PLAY url", url)
						quality = directstream.googletag(url)[0]['quality']
						url = client.replaceHTMLCodes(url)
						url = url.encode('utf-8')
						sources.append({'source': 'gvideo', 'quality': quality, 'provider': 'Moviego', 'url': url, 'direct': True, 'debridonly': False})
			except:
				pass

				
			try:
				url = re.findall('file:\s+"([^"]+)"',link)[0]
				sources.append({'source': 'cdn', 'quality': quality, 'provider': 'Moviego', 'url': url, 'direct': True, 'debridonly': False})
			except:
				pass
			
			return sources
        except:
            return sources
Beispiel #16
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            r = urlparse.urljoin(self.base_link, url)

            result = client.request(r, timeout='10')

            f = client.parseDOM(result, 'iframe', ret='src')
            f = [i for i in f if 'iframe' in i][0]

            result = client.request(f, headers={'Referer': r}, timeout='10')

            r = client.parseDOM(result, 'div', attrs = {'id': 'botones'})[0]
            r = client.parseDOM(r, 'a', ret='href')
            r = [(i, urlparse.urlparse(i).netloc) for i in r]

            links = []

            for u, h in r:
                if not 'pelispedia' in h: continue

                result = client.request(u, headers={'Referer': f}, timeout='10')

                try:
                    if 'pelispedia' in h: raise Exception()

                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')\s*,\s*label\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)
                    url = [i[0] for i in url if '720' in i[1]][0]

                    links.append({'source': 'cdn', 'quality': 'HD', 'url': url, 'direct': False})
                except:
                    pass

                try:
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')', url)

                    for i in url:
                        try:
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i, 'direct': True})
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('gkpluginsphp.*?link\s*:\s*"([^"]+)', result)[0]
                    post = urllib.urlencode({'link': post})

                    url = urlparse.urljoin(self.base_link, '/Pe_flsh/plugins/gkpluginsphp.php')
                    url = client.request(url, post=post, XHR=True, referer=u, timeout='10')
                    url = json.loads(url)['link']

                    links.append({'source': 'gvideo', 'quality': 'HD', 'url': url, 'direct': True})
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)', result)[0]

                    post = urlparse.parse_qs(urlparse.urlparse(post).query)['pic'][0]
                    post = urllib.urlencode({'sou': 'pic', 'fv': '23', 'url': post})

                    url = urlparse.urljoin(self.base_link, '/Pe_Player_Html5/pk/pk_2/plugins/protected.php')
                    url = client.request(url, post=post, XHR=True, timeout='10')
                    url = json.loads(url)[0]['url']

                    links.append({'source': 'cdn', 'quality': 'HD', 'url': url, 'direct': True})
                except:
                    pass

                try:
                    if not jsunpack.detect(result): raise Exception()

                    result = jsunpack.unpack(result)
                    url = re.findall('sources\s*:\s*\[(.+?)\]', result)[0]
                    url = re.findall('file\s*:\s*.*?\'(.+?)\'', url)
                    for i in url:
                        try:
                            i = client.request(i, headers={'Referer': f}, output='geturl', timeout='10')
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i,
                                          'direct': True})
                        except:
                            pass
                except:
                    pass

                try:
                    post = re.findall('var\s+parametros\s*=\s*"([^"]+)', result)[0]

                    post = urlparse.parse_qs(urlparse.urlparse(post).query)['pic'][0]
                    token = 'eyJjdCI6InZGS3QySm9KRWRwU0k4SzZoZHZKL2c9PSIsIml2IjoiNDRkNmMwMWE0ZjVkODk4YThlYmE2MzU0NDliYzQ5YWEiLCJzIjoiNWU4MGUwN2UwMjMxNDYxOCJ9'
                    post = urllib.urlencode({'sou': 'pic', 'fv': '0', 'url': post, 'token': token})

                    url = urlparse.urljoin(self.player_link, '/template/protected.php')
                    url = client.request(url, post=post, XHR=True, timeout='10')
                    js = json.loads(url)
                    url = [i['url'] for i in js]
                    for i in url:
                        try:
                            i = client.request(i, headers={'Referer': f}, output='geturl', timeout='10')
                            links.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'url': i,
                                          'direct': True})
                        except:
                            pass
                except:
                    pass

            for i in links: sources.append({'source': i['source'], 'quality': i['quality'], 'provider': 'Pelispedia', 'url': i['url'], 'direct': i['direct'], 'debridonly': False})

            return sources
        except:
            return sources