예제 #1
0
    def youjizz(self, url):
        try:
            r = client.request(url)
            pattern = r"""filename['"]\:['"]([^'"]+)"""
            i = re.findall(pattern, r)
            log_utils.log('%s' % str(i), log_utils.LOGERROR)
            s = [
                e.replace('\\', '') for e in i
                if ('.mp4' in e) and ('.m3u8' not in e)
            ]
            self.u = []

            def request(i):
                try:
                    c = client.request(i, output='headers')
                    checks = ['video', 'mpegurl']
                    if any(f for f in checks if f in c['Content-Type']):
                        self.u.append((i, int(c['Content-Length'])))
                except:
                    pass

            threads = []
            for i in s:
                threads.append(workers.Thread(request, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            u = sorted(self.u, key=lambda x: x[1])[::-1]
            u = client.request(u[0][0], output='geturl', referer=url)
            log_utils.log('Returning %s from YouJizz' % str(u),
                          log_utils.LOGNOTICE)
            return u
        except:
            return
예제 #2
0
    def justporno(self, url):
        try:
            r = client.request(url)
            s = re.findall('''source\s*src=['"]+([^'"]+)''', r)

            self.u = []

            def request(i):
                try:
                    c = client.request(i, output='headers')
                    checks = ['video', 'mpegurl']
                    if any(f for f in checks if f in c['Content-Type']):
                        self.u.append((i, int(c['Content-Length'])))
                except:
                    pass

            threads = []
            for i in s:
                threads.append(workers.Thread(request, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            u = sorted(self.u, key=lambda x: x[1])[::-1]
            u = client.request(u[0][0], output='geturl')
            return u
        except:
            return
예제 #3
0
    def fourtube(self, url):
        try:
            fourtube_ref = url
            self.fourtube_base = 'https://www.4tube.com'
            self.fourtube_embed = '/embed/%s'
            self.fourtube_player = '/js/player/embed/%s'
            self.fourtube_post = 'https://tkn.kodicdn.com/%s/desktop/%s'
            id = re.findall('\/([0-9]+)', url)[0]
            r = client.request(
                urlparse.urljoin(self.fourtube_base, self.fourtube_embed % id))
            js = re.findall('\/player\/embed\/([^"]+)', r)[0]
            url = urlparse.urljoin(self.fourtube_base,
                                   self.fourtube_player % js)
            r = client.request(url)
            url_id, qual = re.compile(
                'ajax\(url,opts\);}}\)\(([\d]+),[\d]+,\[([\d,]+)\]\);'
            ).findall(r)[0]
            qual = qual.replace(',', '+')
            r = client.request(self.fourtube_post % (url_id, qual),
                               post='',
                               headers={'Origin': self.fourtube_base},
                               referer=fourtube_ref)
            s = re.compile('token\":\"([^"]+)').findall(r)

            self.u = []

            def request(i):
                try:
                    c = client.request(i, output='headers')
                    checks = ['video', 'mpegurl']
                    if any(f for f in checks if f in c['Content-Type']):
                        self.u.append((i, int(c['Content-Length'])))
                except:
                    pass

            threads = []
            for i in s:
                threads.append(workers.Thread(request, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            u = sorted(self.u, key=lambda x: x[1])[::-1]
            u = client.request(u[0][0], output='geturl', referer=url)
            return u
        except:
            return
예제 #4
0
    def info_builder(self, array):
        try:
            '''  from multiprocessing.dummy import Pool as ThreadPool

            pool = ThreadPool(2)
            results = pool.map(self.info_builder_thread, array)
            pool.close()
            pool.join()'''

            from lib import workers

            self.list = [] ; threads= []

            for i in array:
                threads.append(workers.Thread(self.info_builder_thread, i))
            [i.start() for i in threads] ; [i.join() for i in threads]


        except:
            print("Unexpected error in info builder script:", sys.exc_info()[0])
            exc_type, exc_obj, exc_tb = sys.exc_info()
            print(exc_type, exc_tb.tb_lineno)

        return self.list
예제 #5
0
    def generic(self, url, pattern=None):

        try:
            r = client.request(url)
            if 'chaturbate' in url:
                if '.m3u8' not in r:
                    return 'offline'
            if pattern: s = re.findall(r'%s' % pattern, r)
            else:
                patterns = [
                            r'''\s*=\s*[\'\"](http.+?)[\'\"]''', \
                            r'''\s*=\s*['"](http.+?)['"]''', \
                            r'''['"][0-9_'"]+:\s[\'\"]([^'"]+)''', \
                            r'''\(\w+\([\'\"]([^\'\"]*)''', \
                            r'''[\'\"]\w+[\'\"]:['"]([^'"]*)''', \
                            r'''\s*=\s*[\'\"](http.+?)[\'\"]''', \
                            r'''\s*:\s*[\'\"](//.+?)[\'\"]''', \
                            r'''\:[\'\"](\.+?)[\'\"]''', \
                            r'''\s*\(\s*[\'\"](http.+?)[\'\"]''', \
                            r'''\s*=\s*[\'\"](//.+?)[\'\"]''', \
                            r'''\w*:\s*[\'\"](http.+?)[\'\"]''', \
                            r'''\w*=[\'\"]([^\'\"]*)''', \
                            r'''\w*\s*=\s*[\'\"]([^\'\"]*)''', \
                            r'''(?s)<file>([^<]*)''', \
                            ]

                s = []
                for pattern in patterns:
                    l = re.findall(pattern, r)
                    s += [
                        i for i in l
                        if (urlparse.urlparse(i).path).strip('/').split('/')
                        [-1].split('.')[-1] in ['mp4', 'flv', 'm3u8']
                    ]

                if s:
                    s = [
                        i for i in s
                        if (urlparse.urlparse(i).path).strip('/').split('/')
                        [-1].split('.')[-1] in ['mp4', 'flv', 'm3u8']
                    ]
                else:
                    s = client.parseDOM(r,
                                        'source',
                                        ret='src',
                                        attrs={'type': 'video.+?'})

                if not s:
                    log_utils.log(
                        'Error resolving %s :: Error: %s' % (url, str(e)),
                        log_utils.LOGERROR)
                    return

                s = ['http:' + i if i.startswith('//') else i for i in s]
                s = [
                    urlparse.urljoin(url, i) if not i.startswith('http') else i
                    for i in s
                ]
                s = [x for y, x in enumerate(s) if x not in s[:y]]

            self.u = []

            def request(i):
                try:
                    i = i.replace(' ', '%20')
                    c = client.request(i, output='headers', referer=url)
                    checks = ['video', 'mpegurl', 'html']
                    if any(f for f in checks if f in c['Content-Type']):
                        self.u.append((i, int(c['Content-Length'])))
                except:
                    pass

            threads = []
            for i in s:
                threads.append(workers.Thread(request, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            u = sorted(self.u, key=lambda x: x[1])[::-1]

            mobile_mode = kodi.get_setting('mobile_mode')
            if mobile_mode == 'true':
                u = client.request(u[-1][0], output='geturl', referer=url)
            else:
                u = client.request(u[0][0], output='geturl', referer=url)
            log_utils.log('Returning %s from XXX-O-DUS Resolver' % str(u),
                          log_utils.LOGNOTICE)
            return u
        except Exception as e:
            log_utils.log('Error resolving %s :: Error: %s' % (url, str(e)),
                          log_utils.LOGERROR)