Exemplo n.º 1
0
 def boobntit(self, url):
     try:
         main = client.request(url)
         link = client.parseDOM(main, 'div', attrs={'id': 'player'})
         link = client.parseDOM(link, 'iframe', ret='src')
         link = link[0]
         return self.generic(link)
     except:
         return self.generic(url)
Exemplo n.º 2
0
 def megasesso(self, url):
     try:
         u = client.request(url)
         u = client.parseDOM(u, 'div', attrs={'class': 'player-iframe'})
         u = [(client.parseDOM(i, 'iframe', ret='src')) for i in u]
         u = [(client.replaceHTMLCodes(i[0]).encode('utf-8')) for i in u]
         u = 'http://www.megasesso.com' + u[0]
         return self.generic(u)
     except:
         return
Exemplo n.º 3
0
 def yuvutu(self, url):
     try:
         r = client.request(url)
         r = client.parseDOM(r, 'iframe', ret='src')
         r = [i for i in r if 'embed' in i][0]
         r = urlparse.urljoin(url, r)
         return self.generic(r)
     except:
         return
Exemplo n.º 4
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)