예제 #1
0
    def Resolve(self, url):
        print url
        import re        
        from entertainment.net import Net
        net = Net(cached=False,user_agent='Apple-iPhone/')
        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')
        loginurl = 'http://hdtvshows.net/reg.php'
        html = net.http_GET(loginurl).content
        match=re.compile('name="Token(.+?)" value="(.+?)"').findall(html)
        _Token=re.compile('name="data\[\_Token\]\[fields\]" value="(.+?)"').findall(html)[0]
        data     = {'_method':'POST','subscriptionsPass': tv_pwd,
                                            'UserUsername': tv_user,
                                            'Token'+match[0][0]:'login','data[_Token][fields]':_Token}
        headers  = {'Host':'hdtvshows.net',
                                            'Origin':'http://hdtvshows.net',
                                            'Referer':'http://hdtvshows.net/login.php',
                                                    'X-Requested-With':'XMLHttpRequest'}
        html = net.http_POST(loginurl, data, headers)
        cookie_jar = os.path.join(cookie_path, "hdtvshows.lwp")
        if os.path.exists(cookie_path) == False:
                os.makedirs(cookie_path)
        net.save_cookies(cookie_jar)
        net.set_cookies(cookie_jar)        
        html = net.http_GET(url).content
        

        match=re.compile('<video id="ipadvideo" src="(.+?)"').findall(html)
        
        
        
        return  match[0].replace('|','%7C')
예제 #2
0
    def Login(self):
        trakt_user = self.Settings().get_setting('username')
        trakt_password = self.Settings().get_setting('password')
        if trakt_user=="" or trakt_password == "":
            return

        from entertainment.net import Net        
        net = Net(cached=False)            
        
        signin_page = net.http_GET(self.base_url + '/auth/signin').content
        
        import re
        signin_form = re.search('<form class="simple_form form-signin"[^>]+?>(.+?)</form>', signin_page)
        if signin_form:
            signin_form = signin_form.group(1)
            signin_params = {}
            inputs = re.compile('(<input[^>]+?>)').findall(signin_form)
            for input in inputs:
                if 'type="hidden"' in input:
                    name = re.search('name="([^"]+?)"', input).group(1)
                    value = re.search('value="([^"]+?)"', input).group(1)
                    
                    signin_params[name] = value
            
            signin_params['user[login]'] = trakt_user
            signin_params['user[password]'] = trakt_password
            
            net.http_POST(self.base_url + '/auth/signin', signin_params).content
            
            net.save_cookies(self.cookie_file)
예제 #3
0
 def Resolve(self, url):
     try:
         from entertainment.net import Net
         net = Net(cached=False)
         
         import os
         cookie_file = os.path.join(common.cookies_path, 'realdebrid.lwp')
         
         if net.set_cookies(cookie_file) == False:
             import urllib
             credentials = urllib.urlencode({'user' : self.Settings().get_setting('realdebrid-username'), 'pass' : self.Settings().get_setting('realdebrid-password')})
             content = net.http_GET(self.base_url + 'ajax/login.php?' + credentials ).content
             net.save_cookies(cookie_file)
         elif 'My Account' not in net.http_GET(self.base_url).content:
             import urllib
             credentials = urllib.urlencode({'user' : self.Settings().get_setting('realdebrid-username'), 'pass' : self.Settings().get_setting('realdebrid-password')})
             content = net.http_GET(self.base_url + 'ajax/login.php?' + credentials ).content
             net.save_cookies(cookie_file)
             
         content = net.http_GET(self.base_url + 'ajax/unrestrict.php?link=' + url).content
         import re
         r = re.search('[\'"]{1}main_link[\'"]{1}\:[\'"]{1}(.+?)[\'"]{1}', content)
         if r:                
             stream_url = r.group(1)
             if stream_url:
                 return stream_url.replace('\/', '/')
     except Exception, e:
         common.addon.log(self.name.upper() + ' - Exception occured: %s' % e)
         common.addon.show_small_popup('[B][COLOR white]' + self.name.upper() + '[/COLOR][/B]', '[COLOR red]Exception occured, check logs.[/COLOR]')                
         return None
예제 #4
0
 def login(self):
     
     headers={'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
              'Host':'ororo.tv',
              'Pragma':'no-cache',
              'Referer':'http://ororo.tv/en',
              'Upgrade-Insecure-Requests':'1',
              'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
              'Accept-Encoding':'gzip, deflate, sdch',
              'Accept-Language':'en-US,en;q=0.8',
              'Cache-Control':'no-cache',
              'Connection':'keep-alive'}
     tv_user = self.Settings().get_setting('tv_user')
     tv_pwd = self.Settings().get_setting('tv_pwd')        
     from entertainment.net import Net
     
     net = Net(cached=False,user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25')
     
     tries = 0
     while True:
         html = html = net.http_GET('http://ororo.tv/nl/',headers=headers).content
         if html.startswith('http://') and tries < MAX_REDIRECT:
             tries += 1
             url = html
         else:
             break
     
     data = {'user[email]': tv_user, 'user[password]': tv_pwd, 'user[remember_me]': 1}
     html = net.http_POST('http://ororo.tv/en/users/sign_in',data,headers=headers).content
     net.save_cookies(self.cookie_file)
예제 #5
0
    def GetFileHosts(self, id, other_names, region, language, list, lock, message_queue):

        search_term = id
        
        from entertainment.net import Net
        net = Net(cached=False)
                
        user = self.Settings().get_setting('user')
        pwd = self.Settings().get_setting('pwd')
        if user and pwd:
            
            content = net.http_POST('http://www.filmon.com/user/login', {'login':user, 'password':pwd, 'remember':'1'}, 
                headers={'Referer':self.base_url}).content
                
            net.save_cookies(self.cookie_file)

        
        content = net.http_GET(self.base_url).content.encode("utf-8")
        link = content.split('{"id":')
        import re
        for p in link:            
            if '"filmon_' in p: 
                title=p.split('"title":"')[1]
                ITEM_TITLE=title.split('"')[0]
                p_id = common.CreateIdFromString( common.CleanTextForSearch(ITEM_TITLE, strip=True) )
                if id == p_id or p_id in other_names :
                    channel_id=p.split(',')[0]
                    res=['SD','HD']
                    for quality in res:
                        channel_id_with_quality=channel_id + '__' + quality
                        self.AddLiveLink( list, ITEM_TITLE, channel_id_with_quality, language = language.title(),host='FILMON',quality=quality)
                    break
    def Resolve(self, url):

        from entertainment.net import Net
        from entertainment import cloudflare
        import re
        #print url

        UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36'
        net = Net(cached=False, user_agent=UA)

        try:
            net.set_cookies(self.cookie_file)
            result = net.http_GET(url).content
            net.save_cookies(self.cookie_file)
        except:
            result = cloudflare.solve(url, self.cookie_file, UA)
        #print result.encode('ascii','ignore')
        stream = re.compile('return\("(.+?)"').findall(result)[0]
        final = stream.split('://')[1]
        host = final.split('/')[0]

        #cf_clearance=re.compile('cf_clearance=(.+?);').findall(open(self.cookie_file).read())[0]
        #cfduid=re.compile('cfduid=(.+?);').findall(open(self.cookie_file).read())[0]

        #AND='|Host=%s&User-Agent=%s&Referrer=%s&Connection=keep-alive&Cookie=cfduid=%s;' %(host,UA,url,cfduid)

        return stream  #+AND
예제 #7
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue):                 
        
        from entertainment.net import Net
        import re
        net = Net(cached=False)

        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')
            

        if os.path.exists(self.cookie_file):
                try: os.remove(self.cookie_file)
                except: pass
                
        headers = {'Content-Type': 'application/x-www-form-urlencoded',
                   'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                   'Host': 'www.einthusan.com', 'Origin': 'http://www.einthusan.com',
                   'Referer': 'http://www.einthusan.com/index.php?lang=hindi',
                   'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'}


        net.http_GET('http://www.einthusan.com/etc/login.php')
        net.http_POST('http://www.einthusan.com/etc/login.php', {'username': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)  
                                
        name = self.CleanTextForSearch(name)
        
        import urllib
        
        movie_url=self.GoogleSearchByTitleReturnFirstResultOnlyIfValid('einthusan.com', name, 'watch.php', item_count=10, title_extrctr='(.+?) (?:Hindi|hindi|Tamil|tamil|Telugu|telugu|Malayalam|malayalam) movie')
        if movie_url:
            self.GetFileHosts(movie_url, list, lock, message_queue)
예제 #8
0
파일: shared2_hrv.py 프로젝트: bialagary/mw
    def Resolve(self, url):
        import re
        from entertainment.net import Net
        net = Net(cached=False)

        common.addon.log( self.name.upper() + ' - Link: %s' % url )
        common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: [B][COLOR white]' + self.name.upper() + '[/B][/COLOR]',
                                      'Resolving', 700, self.icon)

        html = net.http_GET(url).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)

        try:
            if not re.search(r'value=\"Continue to video',html,re.I):
                raise Exception ('File Not Found')
            
            html = net.http_POST(url,form_data={'Continue':'Continue to video'},
                                 headers={'Content-Type':'application/x-www-form-urlencoded'}
                                 ).content

            finalLink = re.search(r'var\sxxxx\s\=\s\"(.*?)\"',html)
            if finalLink:
                return finalLink.group(1)

            else:
                raise Exception ('No Media Found To Stream')

        except Exception, e:
            common.addon.log(self.name.upper() + ' - Exception occured: %s' % e)
            common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: [B][COLOR white]' + self.name.upper() + '[/B][/COLOR]', '[COLOR red]'+str(e)+'[/COLOR]', 3000, self.icon)                
            return None
    def GetFileHosts(self, url, list, lock, message_queue):

        import re

        from entertainment.net import Net

        net = Net(do_not_cache_if_any=do_no_cache_keywords_list)
        net._cached = False
        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')
        loginurl = 'https://directdownload.tv'
        data = {
            'password': tv_pwd,
            'username': tv_user,
            'Login': '******',
            'mode': 'normal'
        }
        headers = {
            'Referer':
            'https://directdownload.tv',
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
            'Connection':
            'keep-alive',
            'Content-Type':
            'application/x-www-form-urlencoded',
            'Host':
            'directdownload.tv',
            'Origin':
            'http://directdownload.tv',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'
        }
        net.http_POST(loginurl, data, headers).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)

        content = net.http_GET(url).content

        r = '{"url":"(.+?)","hostname":".+?"}'
        match = re.compile(r).findall(content)

        urlselect = []

        for url in match:
            #print url
            if url not in urlselect:
                urlselect.append(url)

                quality = 'SD'
                url_lower = '.' + url.lower() + '.'
                for quality_key, quality_value in common.quality_dict.items():
                    if re.search('[^a-zA-Z0-0]' + quality_key + '[^a-zA-Z0-0]',
                                 url_lower):
                        quality = quality_value
                        break

                self.AddFileHost(list, quality, url.replace('\/', '/'))
예제 #10
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        if os.path.exists(common.cookies_path) == False:
            os.makedirs(common.cookies_path)

        import re
        from entertainment.net import Net

        net = Net(
            cached=False,
            user_agent=
            'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'
        )

        title = self.CleanTextForSearch(title)
        name = self.CleanTextForSearch(name)
        main_url = self.base_url

        helper = '%s (%s)' % (name, year)

        if type == 'movies':
            self.login()
            url = 'http://ororo.tv/nl/movies'
            html = net.http_GET(url).content
            net.save_cookies(self.cookie_file)
            name_lower = common.CreateIdFromString(name)
            r = '<span class=\'value\'>(\d{4}).*?href="([^"]+)[^>]+>([^<]+)'
            match = re.compile(r, re.DOTALL).findall(html)
            for item_year, item_url, item_title in match:
                item_title = item_title.lower()
                if item_title in name_lower:
                    self.GetFileHosts(item_url, list, lock, message_queue)

        elif type == 'tv_episodes':
            self.login()
            name_lower = common.CreateIdFromString(name)
            name_lower = name_lower.replace('_', '-')
            title_url = 'http://ororo.tv/en/shows/' + name_lower
            net.set_cookies(self.cookie_file)
            html2 = net.http_GET(title_url).content
            net.save_cookies(self.cookie_file)
            r = '%s-%s' % (season, episode)
            match = re.compile(
                'data-href="(.+?)".+?class="episode" href="#(.+?)">').findall(
                    html2)
            for item_url, passer in match:
                item_url = 'http://ororo.tv/' + item_url
                if r in passer:

                    self.GetFileHosts(item_url, list, lock, message_queue)
예제 #11
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue):
        
        if os.path.exists(common.cookies_path) == False:
                os.makedirs(common.cookies_path)
                
        import re
        from entertainment.net import Net
        
        net = Net(cached=False,user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25')
        
        title = self.CleanTextForSearch(title) 
        name = self.CleanTextForSearch(name)
        main_url=self.base_url

        helper = '%s (%s)' %(name,year)

        
        if type == 'movies':
            self.login()
            url='http://ororo.tv/nl/movies'
            html = net.http_GET(url).content
            net.save_cookies(self.cookie_file)
            name_lower = common.CreateIdFromString(name)
            r = '<span class=\'value\'>(\d{4}).*?href="([^"]+)[^>]+>([^<]+)'
            match  = re.compile(r,re.DOTALL).findall(html)
            for item_year,item_url,item_title in match:
                item_title=item_title.lower()
                if item_title in name_lower:
                    self.GetFileHosts(item_url, list, lock, message_queue)


        elif type == 'tv_episodes':
            self.login()
            name_lower = common.CreateIdFromString(name)
            name_lower = name_lower.replace('_','-')
            title_url='http://ororo.tv/en/shows/'+name_lower
            net.set_cookies(self.cookie_file)
            html2 = net.http_GET(title_url).content
            net.save_cookies(self.cookie_file)
            r = '%s-%s' % (season, episode)
            match  = re.compile('data-href="(.+?)".+?class="episode" href="#(.+?)">').findall(html2)
            for item_url , passer in match:
                item_url='http://ororo.tv/'+item_url
                if r in passer:

                    self.GetFileHosts(item_url, list, lock, message_queue)
예제 #12
0
    def GetFileHosts(self, url, list, lock, message_queue):

        import re

        from entertainment.net import Net

        net = Net(do_not_cache_if_any=do_no_cache_keywords_list)
        net._cached = False
        tv_user = self.Settings().get_setting("tv_user")
        tv_pwd = self.Settings().get_setting("tv_pwd")
        loginurl = "https://directdownload.tv"
        data = {"password": tv_pwd, "username": tv_user, "Login": "******", "mode": "normal"}
        headers = {
            "Referer": "https://directdownload.tv",
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
            "Connection": "keep-alive",
            "Content-Type": "application/x-www-form-urlencoded",
            "Host": "directdownload.tv",
            "Origin": "http://directdownload.tv",
            "User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36",
        }
        net.http_POST(loginurl, data, headers).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)

        content = net.http_GET(url).content

        r = '{"url":"(.+?)","hostname":".+?"}'
        match = re.compile(r).findall(content)

        urlselect = []

        for url in match:
            print url
            if url not in urlselect:
                urlselect.append(url)

                quality = "SD"
                url_lower = "." + url.lower() + "."
                for quality_key, quality_value in common.quality_dict.items():
                    if re.search("[^a-zA-Z0-0]" + quality_key + "[^a-zA-Z0-0]", url_lower):
                        quality = quality_value
                        break

                self.AddFileHost(list, quality, url.replace("\/", "/"))
예제 #13
0
    def login(self):

        headers = {
            'User-Agent':
            'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
            'Host': 'ororo.tv',
            'Pragma': 'no-cache',
            'Referer': 'http://ororo.tv/en',
            'Upgrade-Insecure-Requests': '1',
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
            'Accept-Encoding': 'gzip, deflate, sdch',
            'Accept-Language': 'en-US,en;q=0.8',
            'Cache-Control': 'no-cache',
            'Connection': 'keep-alive'
        }
        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')
        from entertainment.net import Net

        net = Net(
            cached=False,
            user_agent=
            'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'
        )

        tries = 0
        while True:
            html = html = net.http_GET('http://ororo.tv/nl/',
                                       headers=headers).content
            if html.startswith('http://') and tries < MAX_REDIRECT:
                tries += 1
                url = html
            else:
                break

        data = {
            'user[email]': tv_user,
            'user[password]': tv_pwd,
            'user[remember_me]': 1
        }
        html = net.http_POST('http://ororo.tv/en/users/sign_in',
                             data,
                             headers=headers).content
        net.save_cookies(self.cookie_file)
예제 #14
0
    def Resolve(self, url):
        import re
        from entertainment.net import Net
        net = Net(cached=False)

        common.addon.log(self.name.upper() + ' - Link: %s' % url)
        common.addon.show_small_popup(
            '[B][COLOR blue]I[/B][/COLOR]stream: [B][COLOR white]' +
            self.name.upper() + '[/B][/COLOR]', 'Resolving', 700, self.icon)

        html = net.http_GET(url).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)

        try:
            if not re.search(r'value=\"Continue to video', html, re.I):
                raise Exception('File Not Found')

            html = net.http_POST(url,
                                 form_data={
                                     'Continue': 'Continue to video'
                                 },
                                 headers={
                                     'Content-Type':
                                     'application/x-www-form-urlencoded'
                                 }).content

            finalLink = re.search(r'var\sxxxx\s\=\s\"(.*?)\"', html)
            if finalLink:
                return finalLink.group(1)

            else:
                raise Exception('No Media Found To Stream')

        except Exception, e:
            common.addon.log(self.name.upper() +
                             ' - Exception occured: %s' % e)
            common.addon.show_small_popup(
                '[B][COLOR blue]I[/B][/COLOR]stream: [B][COLOR white]' +
                self.name.upper() + '[/B][/COLOR]',
                '[COLOR red]' + str(e) + '[/COLOR]', 3000, self.icon)
            return None
예제 #15
0
    def GetFileHostsForContent(self, title, name, year, season, episode, type,
                               list, lock, message_queue):

        import re
        from entertainment.net import Net
        net = Net(cached=False)

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

        THE_URL = 'http://moviehdmax.com/search/result?s=%s&selected=false' % name.replace(
            ' ', '+')

        headers = {
            'Host': 'moviehdmax.com',
            'Connection': 'keep-alive',
            'Accept': 'text/plain, */*; q=0.01',
            'X-Requested-With': 'XMLHttpRequest',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
            'Accept-Encoding': 'gzip, deflate, sdch',
            'Accept-Language': 'en-US,en;q=0.8'
        }

        content = net.http_GET(THE_URL, headers=headers).content
        net.save_cookies(self.cookie_file)
        match = re.compile('<a href="\.\./(.+?)">(.+?)</a>').findall(content)
        for url, title in match:
            item_url = 'http://moviehdmax.com/' + url
            if name in self.CleanTextForSearch(title.lower()):
                if type == 'tv_episodes':
                    if 'season-' + season in item_url:
                        self.GetFileHosts(item_url, list, lock, message_queue,
                                          type, season, episode)
                else:
                    if year in title:
                        self.GetFileHosts(item_url, list, lock, message_queue,
                                          type, season, episode)
예제 #16
0
    def Resolve(self, url):
        print url
        import re
        from entertainment.net import Net
        net = Net(cached=False, user_agent='Apple-iPhone/')
        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')
        loginurl = 'http://hdtvshows.net/reg.php'
        html = net.http_GET(loginurl).content
        match = re.compile('name="Token(.+?)" value="(.+?)"').findall(html)
        _Token = re.compile(
            'name="data\[\_Token\]\[fields\]" value="(.+?)"').findall(html)[0]
        data = {
            '_method': 'POST',
            'subscriptionsPass': tv_pwd,
            'UserUsername': tv_user,
            'Token' + match[0][0]: 'login',
            'data[_Token][fields]': _Token
        }
        headers = {
            'Host': 'hdtvshows.net',
            'Origin': 'http://hdtvshows.net',
            'Referer': 'http://hdtvshows.net/login.php',
            'X-Requested-With': 'XMLHttpRequest'
        }
        html = net.http_POST(loginurl, data, headers)
        cookie_jar = os.path.join(cookie_path, "hdtvshows.lwp")
        if os.path.exists(cookie_path) == False:
            os.makedirs(cookie_path)
        net.save_cookies(cookie_jar)
        net.set_cookies(cookie_jar)
        html = net.http_GET(url).content

        match = re.compile('<video id="ipadvideo" src="(.+?)"').findall(html)

        return match[0].replace('|', '%7C')
예제 #17
0
def solve(url,cookie_file='',UA='',wait=True):
        if UA=='':
            UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
        solverregex = re.compile('var t,r,a,f, (.+?)={"(.+?)":(.+?)};.+challenge-form\'\);.*?\n.*?;(.*?);a\.value',  re.DOTALL)
        vcregex = re.compile('<input type="hidden" name="jschl_vc" value="([^"]+)"/>')
        headers={'User-Agent' : UA,'Referer':url}       
        
        request = requests.get(url,headers=headers).content
        passv = re.compile('<input type="hidden" name="pass" value="([^"]+)"/>').findall(request)[0]
        res = solverregex.findall(request)
        if len(res) == 0:
                print "Couldn't find answer script - No cloudflare check?"
                return False
        res=res[0]
        vc = vcregex.findall(request)
        if len(vc)==0:
                print "Couldn't find vc input - No cloudflare check?"
                return False
        vc = vc[0]
        print "VC is ", vc
        varname = (res[0], res[1])
        solved = int(solveEquation(res[2].rstrip()))
        print "Initial value: ", res[2], "Solved:", solved
        for extra in res[3].split(";"):
                extra = extra.rstrip()
                if extra[:len('.'.join(varname))] != '.'.join(varname):
                        print "Extra does not start with varname (", extra, ")"
                else:
                        extra = extra[len('.'.join(varname)):]
                if extra[:2] == "+=":
                        solved += int(solveEquation(extra[2:]))
                elif extra[:2] == "-=":
                        solved -= int(solveEquation(extra[2:]))
                elif extra[:2] == "*=":
                        solved *= int(solveEquation(extra[2:]))
                elif extra[:2] == "/=":
                        solved /= int(solveEquation(extra[2:]))
                else:
                        print "Unknown modifier", extra
        print "Solved value: ", solved

        http=url.split('//')[0]
        domain1=url.split('//')[1]
        domain=domain1.split('/')[0]
        solved += len(domain)
        print "With domain length", solved
        
        from entertainment.net import Net
        net = Net(cached=False)
        
        if wait ==True:
                print 'Sleepin for 6 Seconds'
                import time
                time.sleep(6)
        
        final = net.http_POST(http+"//"+domain+"/cdn-cgi/l/chk_jschl?jschl_vc={0}&pass={1}&jschl_answer={2}".format(vc,passv, solved),'',headers=headers)

        if not cookie_file == '':
            net.save_cookies(cookie_file)
            

                

             
        return final.content
예제 #18
0
    def ExtractContentAndAddtoList(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        if section == 'Recently Posted':
            
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'www.einthusan.com', 'Origin': 'http://www.einthusan.com',
                       'Referer': 'http://www.einthusan.com/index.php?lang=hindi',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'}


            net.http_GET('http://www.einthusan.com/etc/login.php')
            net.http_POST('http://www.einthusan.com/etc/login.php', {'username': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)

            lang = url.split('=')[1].split('&')[0]
            print lang
            new_url = url
            if page == '':
                page = '1'
            else:
                page = str( int(page) )
                new_url = 'http://www.einthusan.com/movies/index.php?lang='+lang+'&organize=Activity&filtered=RecentlyPosted&org_type=Activity&page='+page

            import urllib        
            url = urllib.unquote_plus(url)
            html = net.http_GET(new_url+'&page='+str(page)).content                          
              
            if total_pages == '':
                r= '>([0-9]*)</a></div></div><div id="footer"'
                total_pages = re.compile(r).findall(html)[0]
            self.AddInfo(list, indexer, 'Recently Posted', url, type, str(page), total_pages)
            
            match=re.compile('<h1><a class="movie-title" href="..(.+?)">(.+?)</a></h1>').findall(html)
            for url, name in match:
                name = self.CleanTextForSearch(name)
                name=re.sub('\((Hindi|hindi|Tamil|tamil|Telugu|telugu|Malayalam|malayalam)\)','', name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name,'',type, url, name=name)


        else:
            print 'BLUERAY____________________________________________________________________'
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'www.einthusan.com', 'Origin': 'http://www.einthusan.com',
                       'Referer': 'http://www.einthusan.com/index.php?lang=hindi',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'}


            net.http_GET('http://www.einthusan.com/etc/login.php')
            net.http_POST('http://www.einthusan.com/etc/login.php', {'username': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)

            lang = url.split('=')[1].split('&')[0]
            print lang
            new_url = url
            if page == '':
                page = '1'
            else:
                page = str( int(page) )
                new_url = 'http://www.einthusan.com/bluray/index.php?lang='+lang+'&organize=Activity&filtered=RecentlyPosted&org_type=Activity&page='+page

            import urllib        
            url = urllib.unquote_plus(url)
            html = net.http_GET(new_url+'&page='+str(page)).content                          
              
            if total_pages == '':
                r= '>([0-9]*)</a></div></div><div id="footer"'
                total_pages = re.compile(r).findall(html)[0]
            self.AddInfo(list, indexer, 'Recently Postedb', url, type, str(page), total_pages)
            
            match=re.compile('<h1><a class="movie-title" href="..(.+?)">(.+?) Blu-ray</a></h1>').findall(html)
            for url, name in match:
                name = self.CleanTextForSearch(name)
                name=re.sub('\((Hindi|hindi|Tamil|tamil|Telugu|telugu|Malayalam|malayalam)\)','', name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name,'',type, url, name=name)           
    def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue):                 
        
        #if type!= 'movies': return

        from entertainment.net import Net
        import re
        net = Net(cached=False)

        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')


        if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
            if os.path.exists(self.cookie_file):
                try: os.remove(self.cookie_file)
                except: pass

            common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                          '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                          7000, self.icon)
            return
            

        if os.path.exists(self.cookie_file):
                try: os.remove(self.cookie_file)
                except: pass
                
        headers = {'Content-Type': 'application/x-www-form-urlencoded',
                   'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                   'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                   'Referer': 'http://superchillin.com/login.php',
                   'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


        net.http_GET('http://superchillin.com/login.php')
        net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)
                       
        name = self.CleanTextForSearch(name)
        name = name.rstrip()
        #
        import urllib        
        movie_url='http://superchillin.com/search.php?q=%s' %(name.replace(' ','+'))
        
        html = net.http_GET(movie_url).content
        if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
            common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                          '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                          7000, self.icon)
        if type == 'movies':
            name_lower = common.CreateIdFromString(name)        
            for item in re.finditer(r"href='/(.+?)'>(.+?)</a> \((.+?)\)", html):
                item_url = self.base_url + item.group(1)
                item_name = common.CreateIdFromString(item.group(2))
                item_year = item.group(3)
                #item_url = item_url+'&hd=1'
            
                if item_name == name_lower and item_year == year:
                    self.GetFileHosts(item_url + '__movies', list, lock, message_queue)
                    

        elif type == 'tv_episodes':
            name_lower = common.CreateIdFromString(name)        
            for item in re.finditer(r"<i>TV Series</i></b><br><br>.+? href='/(.+?)'>(.+?)</a>", html):
                item_url = self.base_url + item.group(1)
                item_name = common.CreateIdFromString(item.group(2))
                html = net.http_GET(item_url).content
                #<b>(.+?)x(.+?) - <a style='text.+? href='/(.+?)'>(.+?)</a></b>
                #<b>(.+?)x(.+?) .+? href='/(.+?)'>(.+?)</a>
                season_pull = "0%s"%season if len(season)<2 else season
                episode_pull = "0%s"%episode if len(episode)<2 else episode
                for item in re.finditer(r"<b>"+season+"x"+episode_pull+" - <a style='text.+? href='/(.+?)'>(.+?)</a></b>", html):
                    item_url2 = self.base_url + item.group(1)
                    item_title = item.group(2)
                    
                
                    if item_name == name_lower:
                        self.GetFileHosts(item_url2, list, lock, message_queue)
    def ExtractContentAndAddtoList(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        if section == 'latest':
            
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Noobroom',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)               
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)#[:25]#, [26:50]
            
            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)


            

        elif section == 'azlist':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)

            match=re.compile("href='/(.+?)'>(.+?)</a><br>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name,'',type, url=url, name=name)

        elif section == 'year':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'rating':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br><b>(.+?)</b> - (.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for rating,year,url,name in match:
                name = self.CleanTextForSearch(name)#href='/?3304'>Annie</a> - PG</div>
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name +' ('+'[COLOR royalblue]'+rating+'[/COLOR])'+' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'kids':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<b><a style=\'color:#fff\' href=\'(.+?)\'>(.+?)</a> - (.+?)</div>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name,pg in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                pg = '[COLOR royalblue]'+pg+'[/COLOR]'
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + pg +')','',type, url=url, name=name)

        elif section == 'random':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Noobroom',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile('<a title="The Internet Movie Database" style="text-decoration: none; color: .+? href="(.+?)"').findall(html)
            for url in match:
                html2 = net.http_GET(url).content
                match2=re.compile('<title>(.+?) (\([\d]{4}\)) - IMDb</title>').findall(html2)
                for name,year in match2:
                                    
                    name = self.CleanTextForSearch(name)
                    url = self.base_url
                    year=year.replace('(','').replace(')','')
                    self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'tvshows':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("href='/(.+?)'>(.+?)</a></b><br><br>\s*<span style='color:.+?;font-size:14px'>.+?Latest: (.+?) - <b>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name,eps in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list, indexer, common.mode_Content, name+ ' (' + '[COLOR red]'+eps+'[/COLOR]' +')', '', 'tv_seasons', url=url, name=name)

        elif section == 'tvshowsadded':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<a href='(.+?)'><img style='border:0' src='(.+?)' width='53' height='79'></a>.+?<a style='color:#fff' href='.+?'>(.+?)</a></b><br><br>.+?Latest: (.+?) - <b><span style='color:#fff'>(.+?)</span>",re.DOTALL).findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,image,name,eps,title in match:
                url = 'http://superchillin.com'+url
    
                name = self.CleanTextForSearch(name)
                
                self.AddContent(list, indexer, common.mode_Content, name+ ' (' + '[COLOR red]'+eps+'[/COLOR]' +')', '', 'tv_seasons', url=url, name=name)

        else:
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)           
예제 #21
0
    def GetFileHosts(self, url, list, lock, message_queue, type):

        import re, time, base64
        from entertainment.net import Net
        net = Net(cached=False)

        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': 'www.cartoonhd.mobi',
            'Origin': 'http://www.cartoonhd.mobi',
            'Pragma': 'no-cache',
            'Referer': 'http://www.cartoonhd.mobi',
            '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',
            'X-Requested-With': 'XMLHttpRequest'
        }

        cookie = net.http_GET('http://cartoonhd.mobi/index.php',
                              headers=headers).content
        #cookie=net.get_cookies()
        #print cookie

        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 = net.http_GET(url, headers=headers).content

        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': 'www.cartoonhd.mobi',
            'Origin': 'http://www.cartoonhd.mobi',
            'Pragma': 'no-cache',
            'Referer': url,
            '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',
            'X-Requested-With': 'XMLHttpRequest',
            'Authorization': 'Bearer ' + COOKIE.replace('%3D', '=')
        }

        OPTION = re.compile(
            '<option value="(.+?)" data-type="(.+?)">').findall(content)

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

        new_search = 'http://www.cartoonhd.mobi/ajax/embeds.php'

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

        import requests
        content = requests.post(new_search, data=data, headers=headers).content
        #print content

        for option, server in OPTION:
            #print option
            #print server
            if '-' in server:
                quality = server.split('-')[1].strip().upper()
                name = server.split('-')[0].strip().upper()
                if '320P' in quality:
                    quality = 'SD'
            else:
                quality = 'SD'
                name = server.upper()

            r = '"%s".+?iframe src="(.+?)"' % option
            #print r
            FINAL_URL = re.compile(r, re.IGNORECASE).findall(
                content.replace('\\', ''))[0]

            if 'mail.ru' in FINAL_URL:
                matchme = re.compile('"metadataUrl":"(.+?)"').findall(
                    net.http_GET(FINAL_URL).content)[0]
                quality, url = self.GrabMailRu(matchme, list)

            else:

                self.AddFileHost(list,
                                 quality,
                                 FINAL_URL.split('"')[0],
                                 host=name)
    def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue):                 
        
        #if type!= 'movies': return

        from entertainment.net import Net
        import re
        net = Net(cached=False)

        tv_user = self.Settings().get_setting('tv_user')
        tv_pwd = self.Settings().get_setting('tv_pwd')


        if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
            if os.path.exists(self.cookie_file):
                try: os.remove(self.cookie_file)
                except: pass

            common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                          '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                          7000, self.icon)
            return
            

        if os.path.exists(self.cookie_file):
                try: os.remove(self.cookie_file)
                except: pass
                
        headers = {'Content-Type': 'application/x-www-form-urlencoded',
                   'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                   'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                   'Referer': 'http://superchillin.com/login.php',
                   'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


        net.http_GET('http://superchillin.com/login.php')
        net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
        net.save_cookies(self.cookie_file)
        net.set_cookies(self.cookie_file)
                       
        name = self.CleanTextForSearch(name)
        name = name.rstrip()
        #
        import urllib        
        movie_url='http://superchillin.com/search.php?q=%s' %(name.replace(' ','+'))
        
        html = net.http_GET(movie_url).content
        if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
            common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                          '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                          7000, self.icon)
        if type == 'movies':
            name_lower = common.CreateIdFromString(name)        
            for item in re.finditer(r"href='/(.+?)'>(.+?)</a> \((.+?)\)", html):
                item_url = self.base_url + item.group(1)
                item_name = common.CreateIdFromString(item.group(2))
                item_year = item.group(3)
                #item_url = item_url+'&hd=1'
            
                if item_name == name_lower and item_year == year:
                    self.GetFileHosts(item_url + '__movies', list, lock, message_queue)
                    

        elif type == 'tv_episodes':
            name_lower = common.CreateIdFromString(name)        
            for item in re.finditer(r"<i>TV Series</i></b><br><br>.+? href='/(.+?)'>(.+?)</a>", html):
                item_url = self.base_url + item.group(1)
                item_name = common.CreateIdFromString(item.group(2))
                html = net.http_GET(item_url).content
                #<b>(.+?)x(.+?) - <a style='text.+? href='/(.+?)'>(.+?)</a></b>
                #<b>(.+?)x(.+?) .+? href='/(.+?)'>(.+?)</a>
                season_pull = "0%s"%season if len(season)<2 else season
                episode_pull = "0%s"%episode if len(episode)<2 else episode
                for item in re.finditer(r"<b>"+season+"x"+episode_pull+" - <a style='text.+? href='/(.+?)'>(.+?)</a></b>", html):
                    item_url2 = self.base_url + item.group(1)
                    item_title = item.group(2)
                    
                
                    if item_name == name_lower:
                        self.GetFileHosts(item_url2, list, lock, message_queue)
    def ExtractContentAndAddtoList(self, indexer, section, url, type, list, page='', total_pages='', sort_by='', sort_order=''): 
        if section == 'latest':
            
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Noobroom',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)               
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)#[:25]#, [26:50]
            
            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)


            

        elif section == 'azlist':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)

            match=re.compile("href='/(.+?)'>(.+?)</a><br>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name,'',type, url=url, name=name)

        elif section == 'year':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'rating':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br><b>(.+?)</b> - (.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for rating,year,url,name in match:
                name = self.CleanTextForSearch(name)#href='/?3304'>Annie</a> - PG</div>
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name +' ('+'[COLOR royalblue]'+rating+'[/COLOR])'+' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'kids':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<b><a style=\'color:#fff\' href=\'(.+?)\'>(.+?)</a> - (.+?)</div>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name,pg in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                pg = '[COLOR royalblue]'+pg+'[/COLOR]'
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + pg +')','',type, url=url, name=name)

        elif section == 'random':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Noobroom',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile('<a title="The Internet Movie Database" style="text-decoration: none; color: .+? href="(.+?)"').findall(html)
            for url in match:
                html2 = net.http_GET(url).content
                match2=re.compile('<title>(.+?) (\([\d]{4}\)) - IMDb</title>').findall(html2)
                for name,year in match2:
                                    
                    name = self.CleanTextForSearch(name)
                    url = self.base_url
                    year=year.replace('(','').replace(')','')
                    self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)

        elif section == 'tvshows':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("href='/(.+?)'>(.+?)</a></b><br><br>\s*<span style='color:.+?;font-size:14px'>.+?Latest: (.+?) - <b>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,name,eps in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list, indexer, common.mode_Content, name+ ' (' + '[COLOR red]'+eps+'[/COLOR]' +')', '', 'tv_seasons', url=url, name=name)

        elif section == 'tvshowsadded':
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<a href='(.+?)'><img style='border:0' src='(.+?)' width='53' height='79'></a>.+?<a style='color:#fff' href='.+?'>(.+?)</a></b><br><br>.+?Latest: (.+?) - <b><span style='color:#fff'>(.+?)</span>",re.DOTALL).findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for url,image,name,eps,title in match:
                url = 'http://superchillin.com'+url
    
                name = self.CleanTextForSearch(name)
                
                self.AddContent(list, indexer, common.mode_Content, name+ ' (' + '[COLOR red]'+eps+'[/COLOR]' +')', '', 'tv_seasons', url=url, name=name)

        else:
            from entertainment.net import Net
            import re
            net = Net(cached=False)

            tv_user = self.Settings().get_setting('tv_user')
            tv_pwd = self.Settings().get_setting('tv_pwd')


            if tv_user == 'Enter your Superchillin email' or tv_pwd == 'xunity' or tv_user == '' or tv_pwd == '':
                if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass

                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Enter Login & Password in Settings[/COLOR]',
                                              7000, self.icon)
                return
                

            if os.path.exists(self.cookie_file):
                    try: os.remove(self.cookie_file)
                    except: pass
                    
            headers = {'Content-Type': 'application/x-www-form-urlencoded',
                       'Connection': 'keep-alive', 'Cache-Control': 'max-age=0',
                       'Host': 'superchillin.com', 'Origin': 'http://superchillin.com',
                       'Referer': 'http://superchillin.com/login.php',
                       'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}


            net.http_GET('http://superchillin.com/login.php')
            net.http_POST('http://superchillin.com/login2.php', {'email': str(tv_user), 'password': str(tv_pwd)}, headers, auto_read_response=False).content
            net.save_cookies(self.cookie_file)
            net.set_cookies(self.cookie_file)


            import urllib        
            
            html = net.http_GET(url).content
            if not re.search(r'\"logout.php\"\>Logout\<\/a\>', html, re.I):
                common.addon.show_small_popup('[B][COLOR blue]I[/B][/COLOR]stream: Superchillin',
                                              '[COLOR red]Please Check Login & Password Are Correct[/COLOR]',
                                              7000, self.icon)
                
            match=re.compile("<br>(.+?) - <a[^>]+?href='(.+?)'>(.+?)</a>").findall(html)

            ''' Pagination Code Start '''
            num_items_on_a_page = 25
            if page == '':                
                page = '1'
                total_items = len(match)
                total_pages = str ( ( total_items / num_items_on_a_page ) + ( 1 if total_items % num_items_on_a_page >= 1 else 0) )
                
            self.AddInfo(list, indexer, section, url, type, page, total_pages, sort_by, sort_order)
            
            start_index = ( int(page) - 1 ) * num_items_on_a_page
            match = match[ start_index : start_index + num_items_on_a_page  ]
            ''' Pagination Code End '''
            
            for year,url,name in match:
                name = self.CleanTextForSearch(name)
                url = self.base_url + url
                self.AddContent(list,indexer,common.mode_File_Hosts,name + ' (' + '[COLOR red]'+year+'[/COLOR]' +')','',type, url=url, name=name, year=year)           
예제 #24
0
    def GetFileHosts(self, url, list, lock, message_queue,type):

        import re,time,base64
        from entertainment.net import Net
        net = Net(cached=False)
     
        
       
        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':'www.cartoonhd.mobi',
                'Origin':'http://www.cartoonhd.mobi',
                'Pragma':'no-cache',
                'Referer':'http://www.cartoonhd.mobi',
                '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',
                'X-Requested-With':'XMLHttpRequest'}

        cookie = net.http_GET('http://cartoonhd.mobi/index.php',headers=headers).content
        #cookie=net.get_cookies()
        #print cookie
        
        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 = net.http_GET(url,headers=headers).content
        
        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':'www.cartoonhd.mobi',
                'Origin':'http://www.cartoonhd.mobi',
                'Pragma':'no-cache',
                'Referer':url,
                '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',
                'X-Requested-With':'XMLHttpRequest',
                'Authorization': 'Bearer '+COOKIE.replace('%3D','=')}

        
        OPTION= re.compile('<option value="(.+?)" data-type="(.+?)">').findall(content)

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

        new_search='http://www.cartoonhd.mobi/ajax/embeds.php'

        data={'action':get,'idEl':id,'token':token,'elid':TIME}
   
        import requests
        content = requests.post(new_search, data=data, headers=headers).content
        #print content
        
        for option , server in OPTION:
            #print option
            #print server
            if '-' in server:
                quality= server.split('-')[1].strip().upper()
                name= server.split('-')[0].strip().upper()
                if '320P' in quality:
                    quality= 'SD'  
            else:
                quality= 'SD'
                name= server.upper()             

            r = '"%s".+?iframe src="(.+?)"' % option
            #print r
            FINAL_URL  = re.compile(r,re.IGNORECASE).findall(content.replace('\\',''))[0]
            
            if 'mail.ru' in FINAL_URL:
                matchme=re.compile('"metadataUrl":"(.+?)"').findall(net.http_GET(FINAL_URL).content)[0]
                quality,url=self.GrabMailRu(matchme,list)
    
            else:
            
                self.AddFileHost(list, quality, FINAL_URL.split('"')[0],host=name)
예제 #25
0
파일: cloudflare.py 프로젝트: bialagary/mw
def solve(url, cookie_file='', UA='', wait=True):
    if UA == '':
        UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
    solverregex = re.compile(
        'var t,r,a,f, (.+?)={"(.+?)":(.+?)};.+challenge-form\'\);.*?\n.*?;(.*?);a\.value',
        re.DOTALL)
    vcregex = re.compile(
        '<input type="hidden" name="jschl_vc" value="([^"]+)"/>')
    headers = {'User-Agent': UA, 'Referer': url}

    request = requests.get(url, headers=headers).content
    passv = re.compile('<input type="hidden" name="pass" value="([^"]+)"/>'
                       ).findall(request)[0]
    res = solverregex.findall(request)
    if len(res) == 0:
        print "Couldn't find answer script - No cloudflare check?"
        return False
    res = res[0]
    vc = vcregex.findall(request)
    if len(vc) == 0:
        print "Couldn't find vc input - No cloudflare check?"
        return False
    vc = vc[0]
    print "VC is ", vc
    varname = (res[0], res[1])
    solved = int(solveEquation(res[2].rstrip()))
    print "Initial value: ", res[2], "Solved:", solved
    for extra in res[3].split(";"):
        extra = extra.rstrip()
        if extra[:len('.'.join(varname))] != '.'.join(varname):
            print "Extra does not start with varname (", extra, ")"
        else:
            extra = extra[len('.'.join(varname)):]
        if extra[:2] == "+=":
            solved += int(solveEquation(extra[2:]))
        elif extra[:2] == "-=":
            solved -= int(solveEquation(extra[2:]))
        elif extra[:2] == "*=":
            solved *= int(solveEquation(extra[2:]))
        elif extra[:2] == "/=":
            solved /= int(solveEquation(extra[2:]))
        else:
            print "Unknown modifier", extra
    print "Solved value: ", solved

    http = url.split('//')[0]
    domain1 = url.split('//')[1]
    domain = domain1.split('/')[0]
    solved += len(domain)
    print "With domain length", solved

    from entertainment.net import Net
    net = Net(cached=False)

    if wait == True:
        print 'Sleepin for 6 Seconds'
        import time
        time.sleep(6)

    final = net.http_POST(
        http + "//" + domain +
        "/cdn-cgi/l/chk_jschl?jschl_vc={0}&pass={1}&jschl_answer={2}".format(
            vc, passv, solved),
        '',
        headers=headers)

    if not cookie_file == '':
        net.save_cookies(cookie_file)

    return final.content