def GetFileHosts(self, url, list, lock, message_queue, season, episode, type, year):

        from entertainment import requests
        import hashlib,re,time

        referer = url
        headers = {'User-Agent':self.User_Agent}
        link = requests.get(url, headers=headers).content
        headers = {'Accept-Encoding':'gzip, deflate, sdch', 'Accept-Language':'en-US,en;q=0.8',
                   'Referer':referer, 'User-Agent':self.User_Agent, 'X-Requested-With':'XMLHttpRequest'}
        request_url = '%s/play/play' %self.base_url
        time_now = int(time.time() * 1000)
        uniques = []

        key = '*@'
        key2 = 'ai'
        key3 = 'e12b950be6ed61fa6a89f390bd9a0ec6'

        media_year = re.compile('Release:</b>(.+?)</').findall(link)[0]

        if year in media_year:

            if type == 'tv_episodes':

                try:
                    
                    match = re.compile('<a class="btn-eps.+?" data-episode="(.+?)" data-film="(.+?)".+?>(.+?)</a>').findall(link)

                    for episode_id, film_id, title in match:
                        episode_pull = '0%s' %episode if len(episode) <2 else episode
                        
                        if 'episode %s' %episode_pull in title.lower():
                            hash_id = hashlib.md5(episode_id + key + film_id + key2 + str(time_now) + key3).hexdigest()
                            params = {'f':film_id, 'e':episode_id, 'p':'', 't':time_now, 'a':hash_id, 's':0}
                            final_link = requests.get(request_url, params=params, headers=headers).json()
                            self.add_media(list, final_link)

                except:pass

            else:

                try:

                    film_id = re.compile('data-film="([^"]+)"').findall(link)[0]
                    episode_id = re.compile('data-eposide="([^"]+)"').findall(link)[0]
                    hash_id = hashlib.md5(episode_id + key + film_id + key2 + str(time_now) + key3).hexdigest()
                    params = {'f':film_id, 'e':episode_id, 'p':'', 't':time_now, 'a':hash_id, 's':0}
                    final_link = requests.get(request_url, params=params, headers=headers).json()
                    self.add_media(list, final_link)

                except:pass
    def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue):
        
        from entertainment import requests
        import re

        name = self.CleanTextForSearch(name.lower())
        headers = {'User-Agent':self.User_Agent}
        search = '%s/search?keyword=%s' %(self.base_url,name.replace(' ','+'))
        link = requests.get(search, headers=headers).content
        links = link.split('item">')
        
        for p in links:

            try:

               media_url = re.compile('href="(.+?)"').findall(p)[0]
               if self.base_url not in media_url:
                   media_url = self.base_url + media_url
               media_title = re.compile('title="(.+?)"').findall(p)[0]
               qual = re.compile('class="label">(.+?)</').findall(p)[0].strip()

               if type == 'tv_episodes':
                   if name in self.CleanTextForSearch(media_title.lower()):
                       if 'season %s' %season in media_title.lower():
                           self.GetFileHosts(media_url, list, lock, message_queue, season, episode, type, year)
                        
               else:
                   if name in self.CleanTextForSearch(media_title).lower():
                       self.GetFileHosts(media_url, list, lock, message_queue, '', '', type, year)

            except:pass
Beispiel #3
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        from entertainment import requests
        requests.packages.urllib3.disable_warnings()

        import re

        base_url = self.GetDomain()

        title = self.CleanTextForSearch(title)
        query = self.CleanTextForSearch(name)
        #print ':::::::::::::::::::::::::::::::::'
        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': base_url
        }

        url = base_url + 'movie/search/' + str(query).replace(' ', '+')

        #net.set_cookies(self.cookie_file)
        LINK = requests.get(url, headers=headers, verify=False).content

        LINK = LINK.split('"ml-item">')
        for p in LINK:
            try:
                movie_url = re.compile('a href="(.+?)"',
                                       re.DOTALL).findall(p)[0]
                name = re.compile('title="(.+?)"', re.DOTALL).findall(p)[0]

                movie_url = movie_url + 'watching.html'
                if type == 'tv_episodes':
                    if query.lower() in self.CleanTextForSearch(name.lower()):
                        if 'Season ' + season in name:
                            self.GetFileHosts(movie_url, list, lock,
                                              message_queue, season, episode,
                                              type, year, query, base_url)

                else:
                    if query.lower() in self.CleanTextForSearch(name.lower()):
                        self.GetFileHosts(movie_url, list, lock, message_queue,
                                          season, episode, type, year, query,
                                          base_url)

            except:
                pass
    def GetDomain(self):

        from entertainment import requests

        url = ['https://cartoonhd.cc/', 'https://cartoonhd.online/']
        for URL in url:
            headers = {
                'User-Agent':
                'Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4',
                'Referer': URL
            }
            try:
                hello = requests.get(URL, headers=headers, verify=False)

                domain = hello.url
                cookie = hello.content
                return domain, cookie
            except:
                pass
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        from entertainment import requests
        import re

        title = self.CleanTextForSearch(title)
        name = self.CleanTextForSearch(name)
        #print ':::::::::::::::::::::::::::::::::'

        headers = {
            'user-agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'x-requested-with': 'XMLHttpRequest'
        }

        URL = 'https://xmovies8.ru/movies/search?s=' + name.replace(' ', '+')

        html = requests.get(URL, headers=headers, verify=False).content

        match = re.compile(
            '<h2 class="tit"><a href="(.+?)" title="(.+?)"').findall(html)
        uniques = []
        for movie_url, TITLE in match:

            if type == 'tv_episodes':
                if name.lower() in TITLE.lower():
                    if 'season ' + season in TITLE.lower():
                        if movie_url not in uniques:
                            uniques.append(movie_url)
                            self.GetFileHosts(movie_url + 'watching.html',
                                              list, lock, message_queue,
                                              season, episode, type, year)
            else:
                if name.lower() in TITLE.lower():

                    if year in TITLE.lower():
                        if movie_url not in uniques:
                            uniques.append(movie_url)

                            self.GetFileHosts(movie_url + 'watching.html',
                                              list, lock, message_queue,
                                              season, episode, type, year)
Beispiel #6
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        from entertainment import requests

        import re

        season_pull = "0%s" % season if len(season) < 2 else season

        title = self.CleanTextForSearch(title)
        query = self.CleanTextForSearch(name).lower()
        #print ':::::::::::::::::::::::::::::::::'
        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': 'http://123moviesfree.com/',
            'Host': '123moviesfree.com'
        }

        url = 'http://123moviesfree.com/movie/search/' + str(query).replace(
            ' ', '+') + '.html'

        #net.set_cookies(self.cookie_file)
        LINK = requests.get(url, headers=headers, verify=False).content

        LINK = LINK.split('ml-item')
        for p in LINK:
            try:
                movie_url = re.compile('href="(.+?)"').findall(p)[0]
                name = re.compile('title="(.+?)"').findall(p)[0]

                if type == 'tv_episodes':
                    if query.lower() in self.CleanTextForSearch(name.lower()):
                        if 's' + season_pull in name.lower():
                            self.GrabAdditional(movie_url, list, episode, type)

                else:
                    if query.lower() == self.CleanTextForSearch(name.lower()):
                        self.GrabAdditional(movie_url, list, episode, type)

            except:
                pass
Beispiel #7
0
    def GetDomain(self):

        from entertainment import requests
        requests.packages.urllib3.disable_warnings()

        headers = {
            'User-Agent':
            'Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4'
        }
        url = ['https://gomovies.tech/']

        for URL in url:
            HOST = URL.split('//')[1]

            try:
                hello = requests.get(URL, headers=headers,
                                     verify=False).content
                if HOST in hello:
                    return URL
            except:
                pass
Beispiel #8
0
    def open_url(self, url, headers=''):

        from entertainment import requests

        if not headers:
            headers = {}
            headers['User-Agent'] = self.User_Agent

        import sys
        if sys.version_info < (2, 7, 9):

            if 'myaddrproxy' in url:
                url = 'https://ssl-proxy.my-addr.org' + url
            else:
                url = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/' + url

        else:
            url = url

        link = requests.get(url, headers=headers, verify=False).content
        return link
Beispiel #9
0
    def GetFileHosts(self, url, list, lock, message_queue, season, episode,
                     type, year, again):

        REF = url

        from entertainment import requests

        import re, json

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': REF,
            'Host': '123moviesfree.com'
        }

        LINK = requests.get(url, headers=headers, verify=False).content
        #net.save_cookies(self.cookie_file)

        headers = {
            'Host': '123moviesfree.com',
            'Accept': '*/*',
            'Origin': 'http://123moviesfree.com',
            'X-Requested-With': 'XMLHttpRequest',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Referer': REF,
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'en-US,en;q=0.8'
        }

        #uniques=[REF]

        LINK2 = re.compile('server_servername.+?href="(.+?)"',
                           re.DOTALL).findall(LINK)
        for NEW_URL in LINK2:
            self.GrabAdditional(NEW_URL, list, episode, type)
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        from entertainment import requests
        import re

        name = self.CleanTextForSearch(name.lower())

        headers = {'User-Agent': self.User_Agent}

        search = '%s/?s=%s' % (self.base_url, name.replace(' ', '+'))
        link = requests.get(search, headers=headers, timeout=15).content
        links = link.split('article id=')[1:]

        for p in links:
            try:
                media_url = re.compile('href="([^"]+)"').findall(p)[0]
                media_title = re.compile('title="([^"]+)"').findall(p)[0]
                if name in self.CleanTextForSearch(media_title.lower()):
                    if year in media_title:
                        self.GetFileHosts(media_url, list, lock, message_queue)
            except:
                pass
    def GetFileHosts(self, url, list, lock, message_queue, type, domain,
                     cookie, year):

        import re, time, base64
        from entertainment import requests

        YEARWAY = url.replace('-bollox', '')
        url = url.replace('-%s' % year, '')
        host = domain.split('//')[1]

        headers = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'en-US,en;q=0.8',
            'Cache-Control': 'no-cache',
            'Connection': 'keep-alive',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Host': host,
            'Origin': domain,
            'Pragma': 'no-cache',
            'Referer': domain,
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
            'X-Requested-With': 'XMLHttpRequest'
        }

        #cookie=net.get_cookies()
        #print cookie
        #print '###########################################'
        #print url
        #net.save_cookies(self.cookie_file)
        #COOKIE=re.compile('__utmx="(.+?)"').findall(open(self.cookie_file).read())[0]
        #print COOKIE
        #net.set_cookies(self.cookie_file)

        content = requests.get(domain + url, headers=headers,
                               verify=False).content
        if '%TITLE% (%YEAR%)' in content:

            content = requests.get(domain + YEARWAY,
                                   headers=headers,
                                   verify=False).content

        if '?ckattempt=' in content:

            while True:
                if 'location.href' in content:
                    new = re.compile('location.href="(.+?)"').findall(
                        content)[0]
                    content = requests.get(new, headers=headers,
                                           verify=False).content
                    if not '?ckattempt=' in content:
                        break
                else:
                    break

        TIME = time.time() - 3600

        TIME = str(TIME).split('.')[0]

        TIME = base64.b64encode(TIME, 'strict')

        TIME = TIME.replace('==', '%3D%3D')

        token = re.compile("var tok.+?'(.+?)'").findall(content)[0]
        match = re.compile('elid.+?"(.+?)"').findall(content)
        id = match[0]
        #COOKIE='flixy=%s; %s=%s' % (token,id,TIME)

        headers = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'en-US,en;q=0.8',
            'Cache-Control': 'no-cache',
            'Connection': 'keep-alive',
            'Content-Length': '94',
            #'Cookie':COOKIE,
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Host': host,
            'Origin': domain,
            'Pragma': 'no-cache',
            'Referer': url,
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
            'X-Requested-With': 'XMLHttpRequest'
        }
        #'Authorization': 'Bearer '+COOKIE.replace('%3D','=')

        if type == 'tv_episodes':
            get = 'getEpisodeEmb'
        else:
            get = 'getMovieEmb'

        new_search = domain + '/ajax/nembeds.php'

        data = {'action': get, 'idEl': id, 'token': token, 'elid': TIME}

        content = requests.post(new_search,
                                data=data,
                                headers=headers,
                                verify=False).content
        if '?ckattempt=' in content:

            while True:
                if 'location.href' in content:
                    new = re.compile('location.href="(.+?)"').findall(
                        content)[0]
                    content = requests.post(new,
                                            data=data,
                                            headers=headers,
                                            verify=False).content
                    if not '?ckattempt=' in content:
                        break
                else:
                    break

        quality = 'HD'

        r = '"type":"(.+?)".+?iframe src="(.+?)"'  #% option

        if '1080P' in quality.upper():
            quality = '1080P'
        elif '720P' in quality.upper():
            quality = '720P'
        elif '480P' in quality.upper():
            quality = 'HD'
        else:
            quality = 'SD'

        FINAL = re.compile(r, re.IGNORECASE).findall(content.replace('\\', ''))
        for quality, FINAL_URL in FINAL:
            if '1080P' in quality.upper():
                Q = '1080P'
            elif '720P' in quality.upper():
                Q = '720P'
            elif '480P' in quality.upper():
                Q = 'HD'
            else:
                Q = 'SD'
            if 'openload' in quality.lower():
                Q = 'HD'
            self.AddFileHost(list, Q, FINAL_URL.split('"')[0])
    def GetFileHosts(self, url, list, lock, message_queue, season, episode,
                     type, year):

        from entertainment import requests
        import re, json

        headers = {
            'accept': 'application/json, text/javascript, */*; q=0.01',
            'accept-encoding': 'gzip, deflate, br',
            'accept-language': 'en-US,en;q=0.8',
            'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'origin': 'https://xmovies8.ru',
            'referer': url,
            'user-agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'x-requested-with': 'XMLHttpRequest'
        }

        html = requests.get(url, headers=headers, verify=False).content

        if type == 'tv_episodes':
            grrr = url.split('https://')[1]
            r = '<a href="(.+?%s.+?)" class="active ">episode (.+?)<' % grrr
            match = re.compile(r).findall(html.lower())

            for new_url, ep in match:
                if episode == ep:
                    html = requests.get(new_url, headers=headers,
                                        verify=False).content

                    matched = re.compile("load_player\('(.+?)'\)").findall(
                        html)
                    for id in matched:

                        data = {'id': id}
                        content = json.loads(
                            requests.post(
                                'https://xmovies8.ru/ajax/movie/load_player_v3',
                                data,
                                headers=headers,
                                verify=False).content)
                        second_url = content['value']
                        if not 'http' in second_url:
                            second_url = 'http:' + second_url
                        headers = {
                            'accept':
                            'application/json, text/javascript, */*; q=0.01',
                            'accept-encoding':
                            'gzip, deflate, sdch, br',
                            'accept-language':
                            'en-US,en;q=0.8',
                            'origin':
                            'https://xmovies8.ru',
                            'referer':
                            second_url,
                            'user-agent':
                            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
                        }

                        content = requests.post(second_url,
                                                data,
                                                headers=headers,
                                                verify=False).content
                        link = json.loads(content)
                        DATA = link['playlist'][0]['sources']
                        for field in DATA:
                            FINAL_URL = field['file']
                            res = field['label'].upper()

                            self.AddFileHost(list, res, FINAL_URL)
        else:

            html = requests.get(url, headers=headers, verify=False).content

            matched = re.compile("load_player\('(.+?)'\)").findall(html)
            for id in matched:

                data = {'id': id}
                content = json.loads(
                    requests.post(
                        'https://xmovies8.ru/ajax/movie/load_player_v3',
                        data,
                        headers=headers,
                        verify=False).content)
                second_url = content['value']
                if not 'http' in second_url:
                    second_url = 'http:' + second_url
                headers = {
                    'accept':
                    'application/json, text/javascript, */*; q=0.01',
                    'accept-encoding':
                    'gzip, deflate, sdch, br',
                    'accept-language':
                    'en-US,en;q=0.8',
                    'origin':
                    'https://xmovies8.ru',
                    'referer':
                    second_url,
                    'user-agent':
                    'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
                }

                content = requests.post(second_url,
                                        data,
                                        headers=headers,
                                        verify=False).content
                link = json.loads(content)
                DATA = link['playlist'][0]['sources']
                for field in DATA:
                    FINAL_URL = field['file']
                    res = field['label'].upper()

                    self.AddFileHost(list, res, FINAL_URL)
    def GetFileHosts(self, url, list, lock, message_queue):

        from entertainment import requests
        from entertainment import jsunpack
        import urlresolver, re

        headers = {'User-Agent': self.User_Agent}
        link = requests.get(url, headers=headers, timeout=15).content

        try:
            RES = re.findall(r'Quality:</strong>([^<>]*)<', str(link),
                             re.I | re.DOTALL)[0].upper()
        except:
            RES = ''

        if '4K' in RES:
            res = '4K'
        elif '3D' in RES:
            res = '3D'
        elif '1080' in RES:
            res = '1080P'
        elif '720' in RES:
            res = '720P'
        elif 'HD' in RES:
            res = 'HD'
        elif 'DVD' in RES:
            res = 'DVD'
        elif 'HDTS' in RES:
            res = 'TS'
        elif 'TS' in RES:
            res = 'TS'
        elif 'CAM' in RES:
            res = 'CAM'
        elif 'HDCAM' in RES:
            res = 'CAM'
        else:
            res = '720P'

        iframe_url = re.findall(r'iframe.*?src="([^"]+)"', str(link),
                                re.I | re.DOTALL)

        for source in iframe_url:
            if '/gdp/play/' in source:
                try:

                    source = source.replace('&#038;', '&')
                    link2 = requests.get(source, headers=headers,
                                         timeout=15).content
                    match = ''
                    if 'JuicyCodes' in link2:
                        try:
                            data = re.findall(
                                'type="text/javascript">([^<>]*)<', str(link2),
                                re.I | re.DOTALL)[0]
                            data = data.replace('JuicyCodes.Run(', '').replace(
                                '"+"', '').decode('base64')
                            js_data = jsunpack.unpack(data)
                            match = re.findall(
                                r'"file":"([^"]+)".*?"label":"([^"]+)"',
                                str(js_data), re.I | re.DOTALL)
                        except:
                            pass

                    else:
                        try:
                            if jsunpack.detect(link2):
                                js_data = jsunpack.unpack(link2)
                                match = re.findall(
                                    r'"file":"([^"]+)".*?"label":"([^"]+)"',
                                    str(js_data), re.I | re.DOTALL)
                        except:
                            pass

                    self.AddMedia(list, match)

                except:
                    pass

            else:
                if urlresolver.HostedMediaFile(source):
                    self.AddFileHost(list, res, source)
Beispiel #14
0
    def GetFileHosts(self, url, list, lock, message_queue, season, episode,
                     type, year, query, base_url):

        THEHOST = url.split('//')[1]
        THEHOST = THEHOST.split('/')[0]

        REF = url

        from entertainment import requests
        requests.packages.urllib3.disable_warnings()

        import re, json, urllib, time

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': base_url + ''
        }

        LINK = requests.get(url, headers=headers, verify=False).content
        #net.save_cookies(self.cookie_file)
        User_Agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'

        try:
            media_id = re.compile('name="movie_id" value="(.+?)"').findall(
                LINK)[0]
        except:
            media_id = re.compile('id: "(.+?)"').findall(LINK)[0]

        headers = {
            'Accept':
            'image/webp,image/*,*/*;q=0.8',
            'Accept-Encoding':
            'gzip, deflate, sdch, br',
            'Accept-Language':
            'en-US,en;q=0.8',
            'Referer':
            REF,
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
        }

        #net.set_cookies(self.cookie_file)
        LOAD = requests.get(base_url + 'ajax/movie_episodes/%s' % (media_id),
                            headers=headers,
                            verify=False).content.replace('\\', '')
        LOAD = LOAD.replace('Episode 0', 'Episode ')
        link = LOAD.split('<div id="sv-')
        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': base_url + ''
        }

        for p in link:

            #try:

            res = '720P'

            if type == 'tv_episodes':
                server = p.split('"')[0]
                HTML = p.split('<a title="')

                for d in HTML:
                    try:

                        if ' ' + episode + ':' in d.lower():

                            episode_id = re.compile('id="ep-(.+?)"').findall(
                                d)[0]
                            time_now = int(time.time() * 10000)

                            if int(server) > 10:
                                try:
                                    HEADERS = {
                                        'Accept':
                                        'application/json, text/javascript, */*; q=0.01',
                                        'X-Requested-With': 'XMLHttpRequest',
                                        'User-Agent':
                                        'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
                                        'Referer': REF + '?ep=' + episode_id,
                                        'Accept-Encoding':
                                        'gzip, deflate, sdch, br',
                                        'HOST': THEHOST
                                    }

                                    URL = base_url + '/ajax/load_embed/%s' % (
                                        episode_id)
                                    HTML1 = requests.get(URL,
                                                         headers=HEADERS,
                                                         verify=False).content
                                    HTML2 = json.loads(HTML1)
                                    FINAL_URL = HTML2['embed_url']
                                    if '720p' in FINAL_URL.lower():
                                        res = '720P'
                                    if '1080p' in FINAL_URL.lower():
                                        res = '1080P'
                                    else:
                                        res = '720P'

                                    self.AddFileHost(list, res, FINAL_URL)
                                except:
                                    pass
                            else:

                                try:

                                    slug = '%sajax/movie_token' % base_url
                                    params = {
                                        'eid': episode_id,
                                        'mid': media_id,
                                        '_': time_now
                                    }
                                    headers = {
                                        'Accept':
                                        'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01',
                                        'Accept-Encoding':
                                        'gzip, deflate, sdch, br',
                                        'Accept-Language': 'en-US,en;q=0.8',
                                        'Referer': REF + '?ep=' + episode_id,
                                        'User-Agent': User_Agent,
                                        'X-Requested-With': 'XMLHttpRequest',
                                        'HOST': THEHOST
                                    }
                                    data = requests.get(
                                        slug, params=params,
                                        headers=headers).content

                                    if '$_$' in data:
                                        params = self.__uncensored1(data)
                                    elif data.startswith(
                                            '[]') and data.endswith('()'):
                                        params = self.__uncensored2(data)
                                    else:
                                        params = self.__uncensored3(data)

                                    if params is None:
                                        params = {}

                                    if 'x' in params:

                                        request_url2 = '%sajax/movie_sources/%s' % (
                                            base_url, episode_id)
                                        headers = {
                                            'Accept':
                                            'application/json, text/javascript, */*; q=0.01',
                                            'Accept-Encoding':
                                            'gzip, deflate, sdch, br',
                                            'Accept-Language':
                                            'en-US,en;q=0.8',
                                            'Referer':
                                            REF + '?ep=' + episode_id,
                                            'User-Agent': User_Agent,
                                            'X-Requested-With':
                                            'XMLHttpRequest',
                                            'HOST': THEHOST
                                        }
                                        HTML2 = requests.get(
                                            request_url2,
                                            params=params,
                                            headers=headers,
                                            verify=False).json()
                                        DATA = HTML2['playlist'][0]['sources']
                                        for field in DATA:
                                            FINAL_URL = field['file']
                                            res = field['label']  #.upper()

                                            if not '.srt' in FINAL_URL:
                                                res = res.replace(
                                                    'p',
                                                    '').replace('P',
                                                                '').replace(
                                                                    'CAM',
                                                                    '360')
                                                if not res.isdigit():
                                                    res = '720'

                                                if res == '360':
                                                    res = 'SD'
                                                if res == '480':
                                                    res = 'DVD'
                                                if res == '720':
                                                    res = '720P'
                                                if res == '1080':
                                                    res = '1080P'

                                                HOST = FINAL_URL.split('//')[1]
                                                HOST = HOST.split('/')[0]

                                                self.AddFileHost(
                                                    list,
                                                    res,
                                                    FINAL_URL,
                                                    host=HOST.upper())
                                except:
                                    pass

                    except:
                        pass
            else:
                server = p.split('"')[0]

                HTML = p.split('<a title="')

                for d in HTML:
                    try:

                        YEAR = re.compile('Release:</strong>(.+?)<').findall(
                            LINK)[0].strip()
                        THETITLE = re.compile('"og:title" content="(.+?)"'
                                              ).findall(LINK)[0].strip()
                        if not year:
                            if query.lower() in THETITLE.lower():
                                PASS = True
                        else:
                            if year == YEAR:
                                PASS = True
                        if PASS == True:

                            episode_id = re.compile('id="ep-(.+?)"').findall(
                                d)[0]
                            time_now = int(time.time() * 10000)

                            if int(server) > 10:

                                HEADERS = {
                                    'Accept':
                                    'application/json, text/javascript, */*; q=0.01',
                                    'X-Requested-With': 'XMLHttpRequest',
                                    'User-Agent':
                                    'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
                                    'Referer': REF + '?ep=' + episode_id,
                                    'Accept-Encoding':
                                    'gzip, deflate, sdch, br',
                                    'HOST': THEHOST
                                }
                                URL = base_url + 'ajax/load_embed/%s' % (
                                    episode_id)

                                EMBEDHTML = requests.get(URL,
                                                         headers=HEADERS,
                                                         verify=False).content
                                THEEMBED = json.loads(EMBEDHTML)
                                FINAL_URL = THEEMBED['embed_url']

                                if '720p' in FINAL_URL.lower():
                                    res = '720P'
                                elif '1080p' in FINAL_URL.lower():
                                    res = '1080P'
                                else:
                                    res = 'HD'

                                self.AddFileHost(list, res, FINAL_URL)
                            else:

                                try:

                                    slug = '%sajax/movie_token' % base_url
                                    params = {
                                        'eid': episode_id,
                                        'mid': media_id,
                                        '_': time_now
                                    }
                                    headers = {
                                        'Accept':
                                        'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01',
                                        'Accept-Encoding':
                                        'gzip, deflate, sdch, br',
                                        'Accept-Language': 'en-US,en;q=0.8',
                                        'Referer': REF + '?ep=' + episode_id,
                                        'User-Agent': User_Agent,
                                        'X-Requested-With': 'XMLHttpRequest',
                                        'HOST': THEHOST
                                    }
                                    data = requests.get(
                                        slug, params=params,
                                        headers=headers).content

                                    if '$_$' in data:
                                        params = self.__uncensored1(data)
                                    elif data.startswith(
                                            '[]') and data.endswith('()'):
                                        params = self.__uncensored2(data)
                                    else:
                                        params = self.__uncensored3(data)

                                    if params is None:
                                        params = {}

                                    if 'x' in params:

                                        request_url2 = '%sajax/movie_sources/%s' % (
                                            base_url, episode_id)
                                        headers = {
                                            'Accept':
                                            'application/json, text/javascript, */*; q=0.01',
                                            'Accept-Encoding':
                                            'gzip, deflate, sdch, br',
                                            'Accept-Language':
                                            'en-US,en;q=0.8',
                                            'Referer':
                                            REF + '?ep=' + episode_id,
                                            'User-Agent': User_Agent,
                                            'X-Requested-With':
                                            'XMLHttpRequest',
                                            'HOST': THEHOST
                                        }
                                        HTML2 = requests.get(
                                            request_url2,
                                            params=params,
                                            headers=headers,
                                            verify=False).json()
                                        DATA = HTML2['playlist'][0]['sources']

                                        for field in DATA:
                                            FINAL_URL = field['file']
                                            res = field['label']  #.upper()

                                            #if 'google' in FINAL_URL or 'blogspot' in FINAL_URL or '123movies.ru' in FINAL_URL:
                                            if not '.srt' in FINAL_URL:
                                                res = res.replace(
                                                    'p',
                                                    '').replace('P',
                                                                '').replace(
                                                                    'CAM',
                                                                    '360')
                                                if not res.isdigit():
                                                    res = '720'
                                                #print res
                                                #res=int(res)
                                                #print res
                                                if res == '360':
                                                    res = 'SD'
                                                if res == '480':
                                                    res = 'DVD'
                                                if res == '720':
                                                    res = '720P'
                                                if res == '1080':
                                                    res = '1080P'

                                                HOST = FINAL_URL.split('//')[1]
                                                HOST = HOST.split('/')[0]

                                                self.AddFileHost(
                                                    list,
                                                    res,
                                                    FINAL_URL,
                                                    host=HOST.upper())
                                except:
                                    pass
                    except:
                        pass
Beispiel #15
0
    def GrabAdditional(self, url, list, episode, type):

        REF = url

        from entertainment import requests

        import re, json, hashlib, urllib

        headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
            'Referer': REF,
            'Host': '123moviesfree.com'
        }

        LINK = requests.get(url, headers=headers, verify=False).content
        #net.save_cookies(self.cookie_file)

        headers = {
            'Host': '123moviesfree.com',
            'Accept': '*/*',
            'Origin': 'http://123moviesfree.com',
            'X-Requested-With': 'XMLHttpRequest',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Referer': REF,
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'en-US,en;q=0.8'
        }

        uniques = []
        if type == 'tv_episodes':
            match = re.compile(
                '<a class="episode_(.+?) .+?" href="(.+?)".+?data-film="(.+?)".+?data-name="(.+?)"',
                re.DOTALL).findall(LINK)

            for EP, ip_server, ip_film, ip_name in match:

                if episode == EP:
                    if ip_server not in uniques:
                        uniques.append(ip_server)
                        REF = ip_server

                        LINK = requests.get(ip_server,
                                            headers=headers,
                                            verify=False).content

                        headers = {
                            'Host': '123moviesfree.com',
                            'Accept': '*/*',
                            'Origin': 'http://123moviesfree.com',
                            'X-Requested-With': 'XMLHttpRequest',
                            'User-Agent':
                            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
                            'Content-Type':
                            'application/x-www-form-urlencoded; charset=UTF-8',
                            'Referer': REF,
                            'Accept-Encoding': 'gzip, deflate',
                            'Accept-Language': 'en-US,en;q=0.8'
                        }

                        match = re.compile(
                            'ip_build_player\((.+?),(.+?),(.+?),(.+?)\)'
                        ).findall(LINK)

                        for ip_film, ip_server, ip_name, fix in match:
                            ip_name = ip_name.replace("'", '')
                            ip_server = ip_server.replace("'", '')
                            data = {
                                'ipplugins': '1',
                                'ip_film': ip_film,
                                'ip_server': ip_server,
                                'ip_name': ip_name,
                                'fix': fix
                            }

                            LOAD = requests.post(
                                'http://123moviesfree.com/ip.file/swf/plugins/ipplugins.php',
                                data,
                                headers=headers,
                                verify=False).content
                            LINKS = json.loads(str(LOAD))

                            s = LINKS['s']
                            NEW_URL = 'http://123moviesfree.com/ip.file/swf/ipplayer/ipplayer.php?u=%s%s%s&n=0' % (
                                s, '&w=100%25&h=500&s=', ip_server)
                            LINKED = json.loads(
                                requests.get(NEW_URL,
                                             headers=headers,
                                             verify=False).content)
                            DATA = LINKED['data']

                            if not 'google' in str(LINKED):
                                FINAL_URL = DATA
                                res = '720P'
                                HOST = FINAL_URL.split('//')[1]
                                HOST = HOST.split('/')[0]

                                self.AddFileHost(list,
                                                 res,
                                                 FINAL_URL,
                                                 host=HOST.upper())

                            else:

                                for field in DATA:
                                    FINAL_URL = field['files']
                                    res = field['quality']

                                    res = res.replace('p', '').replace(
                                        'P', '').replace('CAM', '360')
                                    if not res.isdigit():
                                        res = '720'

                                    if res == '1080':
                                        res = '1080P'
                                    elif res == '720':
                                        res = '720P'
                                    elif res == '480':
                                        res = 'DVD'
                                    elif res == '360':
                                        res = 'SD'

                                    else:
                                        res = 'SD'

                                    HOST = FINAL_URL.split('//')[1]
                                    HOST = HOST.split('/')[0]

                                    self.AddFileHost(list,
                                                     res,
                                                     FINAL_URL,
                                                     host=HOST.upper())

        else:
            match = re.compile('ip_build_player\((.+?),(.+?),(.+?),(.+?)\)',
                               re.DOTALL).findall(LINK)

            for ip_film, ip_server, ip_name, fix in match:
                ip_name = ip_name.replace("'", '')
                ip_server = ip_server.replace("'", '')
                data = {
                    'ipplugins': '1',
                    'ip_film': ip_film,
                    'ip_server': ip_server,
                    'ip_name': ip_name,
                    'fix': fix
                }

                LOAD = requests.post(
                    'http://123moviesfree.com/ip.file/swf/plugins/ipplugins.php',
                    data,
                    headers=headers,
                    verify=False).content
                LINKS = json.loads(str(LOAD))

                s = LINKS['s']
                NEW_URL = 'http://123moviesfree.com/ip.file/swf/ipplayer/ipplayer.php?u=%s%s%s&n=0' % (
                    s, '&w=100%25&h=500&s=', ip_server)
                LINKED = json.loads(
                    requests.get(NEW_URL, headers=headers,
                                 verify=False).content)
                DATA = LINKED['data']

                if not 'google' in str(LINKED):
                    FINAL_URL = DATA
                    res = '720P'
                    HOST = FINAL_URL.split('//')[1]
                    HOST = HOST.split('/')[0]

                    self.AddFileHost(list, res, FINAL_URL, host=HOST.upper())

                else:

                    for field in DATA:
                        FINAL_URL = field['files']
                        res = field['quality']

                        if not '.srt' in FINAL_URL:
                            res = res.replace('p',
                                              '').replace('P', '').replace(
                                                  'CAM', '360')
                            if not res.isdigit():
                                res = '720'

                            if res == '1080':
                                res = '1080P'
                            elif res == '720':
                                res = '720P'
                            elif res == '480':
                                res = 'DVD'
                            elif res == '360':
                                res = 'SD'

                            else:
                                res = 'SD'

                            HOST = FINAL_URL.split('//')[1]
                            HOST = HOST.split('/')[0]

                            self.AddFileHost(list,
                                             res,
                                             FINAL_URL,
                                             host=HOST.upper())
    def GetFileHosts(self, url, list, lock, message_queue):

        from entertainment import requests
        from entertainment import jsunpack
        import base64,re,urllib

        headers = {'User-Agent':self.User_Agent}
        link = requests.get(url, headers=headers).content

        try:
            qual = link.split('>Source:<')[1:]
            for p in qual:
                res = re.findall(r'class="finfo-text">([^<]+)</div>', str(link), re.I|re.DOTALL)[0]
                if '1080' in res:
                    res='1080P'                   
                elif '720' in res:
                    res='720P'
                elif  '480' in res:
                    res='DVD'
                elif '360' in res:
                    res='SD'
                elif 'CAM' in res:
                    RES='CAM'
                else:
                    res='DVD'

            try:

                iframe = link.split('"video-responsive"')[1:]
                for p in iframe:

                    iframe_url = re.findall(r'iframe.*?src="([^"]+)"', p, re.I|re.DOTALL)[0]
                    if 'extraload' in iframe_url:
                        link2 = requests.get(iframe_url,headers=headers).content.decode('utf8')
                        match = ''
                        if 'JuicyCodes' in link2:
                            try:
                                data = re.findall('type="text/javascript">([^<>]*)<', str(link2), re.I|re.DOTALL)[0]
                                data = data.replace('JuicyCodes.Run(','').replace('"+"','').decode('base64')
                                js_data = jsunpack.unpack(data)
                                match = re.findall(r'"file":"([^"]+)".*?"label":"([^"]+)"', str(js_data), re.I|re.DOTALL)
                            except:pass

                        else:
                            try:
                                if jsunpack.detect(link2):
                                    js_data = jsunpack.unpack(link2)
                                    match = re.findall(r'"file":"([^"]+)".*?"label":"([^"]+)"', str(js_data), re.I|re.DOTALL)
                            except:pass

                        self.AddMedia(list,match)
                    
                    elif 'goo.gl' not in iframe_url:
                        if 'youtube' not in iframe_url:
                            self.AddFileHost(list, res, iframe_url)

            except:pass

            try:
                    
                match2 = re.findall(r'<a href="([^"]+)"  target="_blank">Watch.+?</a>', str(link), re.I|re.DOTALL)
                if not match2:
                    match2 = re.findall(r'target="_blank" href="(.+?)">Watch',str(link), re.I|re.DOTALL)
                for a in match2:
                    if '=' in a:
                        base64_url = a.split('=')[1]
                        base64_url = urllib.unquote(base64_url).decode('base64')
                        self.AddFileHost(list, res, base64_url)
                    else:
                        self.AddFileHost(list, res, a)

            except:pass
                    
        except:pass