Exemple #1
0
    def __search(self, title, year):
        try:
            r = client.request(self.base_link)
            r = re.findall('sL10n\s*=\s*({.*?});', r)[0]
            r = json.loads(r)['nonce']

            query = self.search_link % (urllib.quote_plus(cleantitle.query(title)), r)
            query = urlparse.urljoin(self.base_link, query)

            t = cleantitle.get(title)
            y = ['%s' % str(year), '%s' % str(int(year) + 1), '%s' % str(int(year) - 1), '0']

            r = client.request(query)
            r = json.loads(r)
            r = [(i, r[i].get('url', ''), r[i].get('title', ''), r[i].get('extra', {}).get('names', ''),
                  r[i].get('extra', {}).get('date', '0')) for i in r]
            r = [(i[0], i[1], client.replaceHTMLCodes(i[2]), client.replaceHTMLCodes(i[3]), i[4]) for i in r]
            r = [i[1] for i in r if t == cleantitle.get(i[2]) or t == cleantitle.get(i[3]) and i[4] in y][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')

            return url
        except:
            return
Exemple #2
0
def yandex(url):
    try:
        cookie = client.request(url, output='cookie')

        r = client.request(url, cookie=cookie)
        r = re.sub(r'[^\x00-\x7F]+', ' ', r)

        sk = re.findall('"sk"\s*:\s*"([^"]+)', r)[0]

        idstring = re.findall('"id"\s*:\s*"([^"]+)', r)[0]

        idclient = binascii.b2a_hex(os.urandom(16))

        post = {
            'idClient': idclient,
            'version': '3.9.2',
            'sk': sk,
            '_model.0': 'do-get-resource-url',
            'id.0': idstring
        }
        post = urllib.urlencode(post)

        r = client.request('https://yadi.sk/models/?_m=do-get-resource-url',
                           post=post,
                           cookie=cookie)
        r = json.loads(r)

        url = r['models'][0]['data']['file']

        return url
    except:
        return
Exemple #3
0
    def __search(self, imdb):
        try:
            r = {'story': imdb, 'do': 'search', 'subaction': 'search'}
            r = urllib.urlencode(r)
            r = client.request(self.base_link, post=r)

            r = client.parseDOM(r, 'div', attrs={'class': 'film-table'})
            r = [
                client.parseDOM(i, 'a', attrs={'class': ''}, ret='href')
                for i in r
            ]
            r = [i[0] for i in r if len(i[0]) > 0]

            if len(r) > 1:
                for i in r:
                    data = client.request(i)
                    data = client.parseDOM(data,
                                           'span',
                                           attrs={'class': 'imdb-rate'},
                                           ret='onclick')
                    data = [d for d in data if imdb in ("'%s'" % imdb) in d]

                    if len(data) >= 1:
                        url = i
            else:
                url = r[0]

            if url:
                url = re.findall('(?://.+?|)(/.+)', url)[0]
                url = client.replaceHTMLCodes(url)
                url = url.encode('utf-8')
                return url
        except:
            return
Exemple #4
0
    def tvshow(self, imdb, tvdb, tvshowtitle, year):
        try:
            url = self.tvsearch_link % cleantitle.geturl(tvshowtitle)

            r = urlparse.urljoin(self.base_link, url)
            r = client.request(r, limit='1')
            r = client.parseDOM(r, 'title')

            if not r:
                url = 'http://www.imdb.com/title/%s' % imdb
                url = client.request(url, headers={'Accept-Language': 'es-ES'})
                url = client.parseDOM(url, 'title')[0]
                url = re.sub('\((?:.+?|)\d{4}.+', '', url).strip()
                url = cleantitle.normalize(url.encode("utf-8"))
                url = self.tvsearch_link % cleantitle.geturl(url)

                r = urlparse.urljoin(self.base_link, url)
                r = client.request(r, limit='1')
                r = client.parseDOM(r, 'title')

            if not year in r[0]: raise Exception()

            return url
        except:
            return
Exemple #5
0
    def sky_list(self, num, channel, id):
        try:
            url = self.sky_now_link % id
            result = client.request(url, timeout='10')
            result = json.loads(result)
            match = result['listings'][id][0]['url']

            dt1 = (self.uk_datetime).strftime('%Y-%m-%d')
            dt2 = int((self.uk_datetime).strftime('%H'))
            if (dt2 < 6): dt2 = 0
            elif (dt2 >= 6 and dt2 < 12): dt2 = 1
            elif (dt2 >= 12 and dt2 < 18): dt2 = 2
            elif (dt2 >= 18): dt2 = 3

            url = self.sky_programme_link % (id, str(dt1), str(dt2))
            result = client.request(url, timeout='10')
            result = json.loads(result)
            result = result['listings'][id]
            result = [i for i in result if i['url'] == match][0]

            year = result['d']
            year = re.findall('[(](\d{4})[)]', year)[0].strip()
            year = year.encode('utf-8')

            title = result['t']
            title = title.replace('(%s)' % year, '').strip()
            title = client.replaceHTMLCodes(title)
            title = title.encode('utf-8')

            self.items.append((title, year, channel, num))
        except:
            pass
Exemple #6
0
    def __search(self, search_link, imdb, title):
        try:
            query = search_link % (urllib.quote_plus(cleantitle.query(title)))
            query = urlparse.urljoin(self.base_link, query)

            t = cleantitle.get(title)

            r = client.request(query)

            r = client.parseDOM(r, 'div', attrs={'class': 'big-list'})
            r = client.parseDOM(r, 'table', attrs={'class': 'row'})
            r = client.parseDOM(r, 'td', attrs={'class': 'list-name'})
            r = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a'))
                 for i in r]
            r = [(i[0][0], i[1][0]) for i in r
                 if len(i[0]) > 0 and len(i[1]) > 0]
            r = [i[0] for i in r if t == cleantitle.get(i[1])][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')

            r = client.request(urlparse.urljoin(self.base_link, url))
            r = client.parseDOM(r,
                                'a',
                                attrs={'href': '[^\'"]+/tt\d+[^\'"]+'},
                                ret='href')
            r = [re.findall('.+?(tt\d+).*?', i) for i in r]
            r = [i[0] for i in r if len(i) > 0]

            return url if imdb in r else None
        except:
            return
Exemple #7
0
    def sourcesResolve(self, item, info=False):
        try:
            self.url = None

            u = url = item['url']

            d = item['debrid']
            direct = item['direct']

            provider = item['provider']
            call = [i[1] for i in self.sourceDict if i[0] == provider][0]
            u = url = call.resolve(url)

            if url == None or not '://' in str(url): raise Exception()

            if not d == '':
                url = debrid.resolver(url, d)

            elif not direct == True:
                hmf = urlresolver.HostedMediaFile(url=u,
                                                  include_disabled=True,
                                                  include_universal=False)
                if hmf.valid_url() == True: url = hmf.resolve()

            if url == False or url == None: raise Exception()

            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit(
                '.')[-1].replace('/', '').lower()
            if ext == 'rar': raise Exception()

            try:
                headers = url.rsplit('|', 1)[1]
            except:
                headers = ''
            headers = urllib.quote_plus(headers).replace(
                '%3D', '=') if ' ' in headers else headers
            headers = dict(urlparse.parse_qsl(headers))

            if url.startswith('http') and '.m3u8' in url:
                result = client.request(url.split('|')[0],
                                        headers=headers,
                                        output='geturl',
                                        timeout='20')
                if result == None: raise Exception()

            elif url.startswith('http'):
                result = client.request(url.split('|')[0],
                                        headers=headers,
                                        output='chunk',
                                        timeout='20')
                if result == None: raise Exception()

            self.url = url
            return url
        except:
            if info == True: self.errorForSources()
            return
Exemple #8
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

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

            url = f.rsplit('?', 1)[0]

            r = client.request(url, mobile=True)

            r = client.parseDOM(r, 'div', attrs={'id': 'servers'})
            r = client.parseDOM(r, 'li')
            r = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'a', ret='title'))

            try:
                s = urlparse.parse_qs(urlparse.urlparse(f).query)['season'][0]
                e = urlparse.parse_qs(urlparse.urlparse(f).query)['episode'][0]
                r = [(i[0], re.findall('(\d+)', i[1])) for i in r]
                r = [(i[0], '%01d' % int(i[1][0]), '%01d' % int(i[1][1]))
                     for i in r if len(i[1]) > 1]
                r = [i[0] for i in r if s == i[1] and e == i[2]]
            except:
                r = [i[0] for i in r]

            for u in r:
                try:
                    url = client.request(u, mobile=True)
                    url = client.parseDOM(url, 'source', ret='src')
                    url = [i.strip().split()[0] for i in url]

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

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

            if url == None: return sources

            if not str(url).startswith('http'):

                data = urlparse.parse_qs(url)
                data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])

                if 'tvshowtitle' in data:
                    url = '%s/episodes/%s-%01dx%01d/' % (self.base_link, cleantitle.geturl(data['tvshowtitle']), int(data['season']), int(data['episode']))
                    year = re.findall('(\d{4})', data['premiered'])[0]
                else:
                    url = '%s/movies/%s/' % (self.base_link, cleantitle.geturl(data['title']))
                    year = data['year']

                url = client.request(url, output='geturl')
                if url == None: raise Exception()

                r = client.request(url)

                y = client.parseDOM(r, 'span', attrs = {'class': 'date'})[0]
                y = re.findall('(\d{4})', y)[0]
                if not y == year: raise Exception()
            else:
                url = urlparse.urljoin(self.base_link, url)

                r = client.request(url)


            links = client.parseDOM(r, 'iframe', ret='src')

            for link in links:
                try:
                    url = link.replace('\/', '/')
                    url = client.replaceHTMLCodes(url)
                    url = 'http:' + url if url.startswith('//') else url
                    url = url.encode('utf-8')

                    if not '.php' in url: raise Exception()

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

                    r = re.findall('file\s*:\s*(?:\"|\')(.+?)(?:\"|\')', r)

                    for i in r:
                        try: sources.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'language': 'en', 'url': i, 'direct': True, 'debridonly': False})
                        except: pass
                except:
                    pass

            return sources
        except:
            return sources
Exemple #10
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:
            if url == None:
                return sources

            hostDict = [(i.rsplit('.', 1)[0], i) for i in hostDict]
            hostDict = [i[0] for i in hostDict]

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
            url = urlparse.urljoin(self.base_link, data['url'])
            season = data['season'] if 'season' in data else False
            episode = data['episode'] if 'episode' in data else False

            r = client.request(url)

            if season and episode:
                r = client.parseDOM(r, 'select', attrs={'id': 'SeasonSelection'}, ret='rel')[0]
                r = client.replaceHTMLCodes(r)[1:]
                r = urlparse.parse_qs(r)
                r = dict([(i, r[i][0]) if r[i] else (i, '') for i in r])
                r = urlparse.urljoin(self.base_link, self.get_links_epi % (r['Addr'], r['SeriesID'], season, episode))
                r = client.request(r)

            r = client.parseDOM(r, 'ul', attrs={'id': 'HosterList'})[0]
            r = re.compile('(<li.+?/li>)', re.DOTALL).findall(r)
            r = [(client.parseDOM(i, 'li', attrs={'id': 'Hoster_\d+'}, ret='rel'),
                  client.parseDOM(i, 'li', attrs={'id': 'Hoster_\d+'})) for i in r]
            r = [(client.replaceHTMLCodes(i[0][0]), i[1][0]) for i in r if len(i[0]) > 0 and len(i[1]) > 0]
            r = [(i[0], re.findall('class="Named"[^>]*>([^<]+).*?(\d+)/(\d+)', i[1])) for i in r]
            r = [(i[0], i[1][0][0].lower().rsplit('.', 1)[0], i[1][0][1], i[1][0][2]) for i in r if len(i[1]) > 0]
            r = [(i[0], i[1], i[3]) for i in r if i[1] in hostDict]

            for i in r:
                u = urlparse.parse_qs('&id=%s' % i[0])
                u = dict([(x, u[x][0]) if u[x] else (x, '') for x in u])
                for x in range(0, int(i[2])):
                    url = self.mirror_link % (u['id'], u['Hoster'], x + 1)
                    if season and episode: url += "&Season=%s&Episode=%s" % (season, episode)
                    try:
                        sources.append(
                            {'source': i[1], 'quality': 'SD',
                             'provider': 'KinoX',
                             'language': 'de',
                             'url': url, 'direct': False,
                             'debridonly': False})
                    except:
                        pass

            return sources
        except:
            return sources
Exemple #11
0
    def movie(self, imdb, title, year):
        try:
            q = self.search_link_2.decode('base64') % urllib.quote_plus(title)

            r = client.request(q)
            if r == None: r = client.request(q)
            if r == None: r = client.request(q)
            if r == None: r = client.request(q)

            r = json.loads(r)['results']
            r = [(i['url'], i['titleNoFormatting']) for i in r]
            r = [(i[0], re.findall('(?:^Watch |)(.+? \(\d{4}\))', i[1]))
                 for i in r]
            r = [(urlparse.urljoin(self.base_link, i[0]), i[1][0]) for i in r
                 if i[1]]

            t = cleantitle.get(title)
            years = [
                '(%s)' % str(year),
                '(%s)' % str(int(year) + 1),
                '(%s)' % str(int(year) - 1)
            ]

            r = [i for i in r if any(x in i[1] for x in years)]

            match = [
                i[0] for i in r
                if t == cleantitle.get(i[1]) and '(%s)' % str(year) in i[1]
            ]

            match2 = [i[0] for i in r]
            match2 = [x for y, x in enumerate(match2) if x not in match2[:y]]
            if match2 == []: return

            for i in match2[:5]:
                try:
                    if len(match) > 0:
                        url = match[0]
                        break
                    r = proxy.request(urlparse.urljoin(self.base_link, i),
                                      'ovie')
                    r = re.findall('(tt\d+)', r)
                    if imdb in r:
                        url = i
                        break
                except:
                    pass

            url = re.findall('(?://.+?|)(/.+)', url)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            pass
Exemple #12
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

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

            r = client.request(url)
            r = client.parseDOM(r, 'div', attrs={'class': 'player_wraper'})
            r = client.parseDOM(r, 'iframe', ret='src')

            for u in r:
                try:
                    m = '"(?:url|src)"\s*:\s*"(.+?)"'

                    d = urlparse.urljoin(self.base_link, u)

                    s = client.request(d, referer=url, timeout='10')
                    u = re.findall(m, s)

                    if not u:
                        p = re.findall('location\.href\s*=\s*"(.+?)"', s)
                        if not p:
                            p = ['/player/%s' % d.strip('/').split('/')[-1]]
                        p = urlparse.urljoin(self.base_link, p[0])
                        s = client.request(p, referer=d, timeout='10')
                        u = re.findall(m, s)

                    for i in u:
                        try:
                            sources.append({
                                'source':
                                'gvideo',
                                'quality':
                                directstream.googletag(i)[0]['quality'],
                                'language':
                                'en',
                                'url':
                                i,
                                'direct':
                                True,
                                'debridonly':
                                False
                            })
                        except:
                            pass
                except:
                    pass

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

            if url == None: return sources

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

            h = {'User-Agent': client.agent()}

            r = client.request(url, headers=h, output='extended')

            s = client.parseDOM(r[0], 'ul', attrs={'class': 'episodes'})
            s = client.parseDOM(s, 'a', ret='data.+?')
            s = [
                client.replaceHTMLCodes(i).replace(':', '=').replace(
                    ',', '&').replace('"', '').strip('{').strip('}') for i in s
            ]

            for u in s:
                try:
                    url = '/io/1.0/stream?%s' % u
                    url = urlparse.urljoin(self.base_link, url)

                    r = client.request(url)
                    r = json.loads(r)

                    url = [i['src'] for i in r['streams']]

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

            return sources
        except:
            return sources
Exemple #14
0
def request(url, check):
    try:
        r = client.request(url)
        if r == None: return r
        if check in str(r): return r.decode('iso-8859-1').encode('utf-8')

        r = client.request(get() + urllib.quote_plus(url))
        if check in str(r): return r.decode('iso-8859-1').encode('utf-8')

        r = client.request(get() + urllib.quote_plus(url))
        if check in str(r): return r.decode('iso-8859-1').encode('utf-8')
    except:
        pass
Exemple #15
0
def getTrakt(url, post=None):
    try:
        url = urlparse.urljoin('http://api-v2launch.trakt.tv', url)

        headers = {
            'Content-Type': 'application/json',
            'trakt-api-key':
            '6df58f8e51beea5f79b129e8c498c52429732365eadfe1bf50dec7557f87abab',
            'trakt-api-version': '2'
        }

        if not post == None: post = json.dumps(post)

        if getTraktCredentialsInfo() == False:
            result = client.request(url, post=post, headers=headers)
            return result

        headers['Authorization'] = 'Bearer %s' % control.setting('trakt.token')

        result = client.request(url,
                                post=post,
                                headers=headers,
                                output='extended',
                                error=True)
        if not (result[1] == '401' or result[1] == '405'): return result[0]

        oauth = 'http://api-v2launch.trakt.tv/oauth/token'
        opost = {
            'client_id':
            '6df58f8e51beea5f79b129e8c498c52429732365eadfe1bf50dec7557f87abab',
            'client_secret':
            'ac7129104289756dd7ffadefdcc3004f20adf63ec6acc65ce1b7e06643624873',
            'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob',
            'grant_type': 'refresh_token',
            'refresh_token': control.setting('trakt.refresh')
        }

        result = client.request(oauth, post=json.dumps(opost), headers=headers)
        result = json.loads(result)

        token, refresh = result['access_token'], result['refresh_token']

        control.setSetting(id='trakt.token', value=token)
        control.setSetting(id='trakt.refresh', value=refresh)

        headers['Authorization'] = 'Bearer %s' % token

        result = client.request(url, post=post, headers=headers)
        return result
    except:
        pass
Exemple #16
0
    def __search(self, title, type, year, season=0, episode=False):
        try:
            query = self.search_link % (
                type, year, urllib.quote_plus(cleantitle.query(title)))
            query = urlparse.urljoin(self.base_link, query)

            t = cleantitle.get(title)

            r = client.request(query)
            r = client.parseDOM(r, 'div', attrs={'class': 'ml-items'})
            r = client.parseDOM(r, 'div', attrs={'class': 'ml-item'})
            r = [(client.parseDOM(i,
                                  'a',
                                  attrs={'class': 'ml-name'},
                                  ret='href'),
                  client.parseDOM(i, 'a', attrs={'class': 'ml-name'}))
                 for i in r]
            r = [(i[0][0], re.sub('<.+?>|</.+?>', '', i[1][0]).strip())
                 for i in r if len(i[0]) > 0 and len(i[1]) > 0]
            r = [(i[0], i[1],
                  re.findall('(.+?)\s+(?:staf+el|s)\s+(\d+)', i[1].lower()))
                 for i in r]
            r = [(i[0], i[2][0][0] if len(i[2]) > 0 else i[1],
                  i[2][0][1] if len(i[2]) > 0 else '0') for i in r]
            r = [
                i[0] for i in r
                if t == cleantitle.get(i[1]) and int(i[2]) == int(season)
            ][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            if episode:
                query = urlparse.urljoin(self.base_link, url)
                r = client.request(query)
                r = client.parseDOM(r, 'div', attrs={'class': 'season-list'})
                r = client.parseDOM(r, 'li')
                r = [(client.parseDOM(i, 'a',
                                      ret='href'), client.parseDOM(i, 'a'))
                     for i in r]
                r = [(i[0][0], i[1][0]) for i in r
                     if len(i[1]) > 0 and int(i[1][0]) == int(episode)]
                url = re.findall('(?://.+?|)(/.+)', r[0][0])[0]
                url = client.replaceHTMLCodes(url)
                url = url.encode('utf-8')
            return url
        except:
            return
Exemple #17
0
    def movie(self, imdb, title, year):
        try:
            langMap = {'hi':'hindi', 'ta':'tamil', 'te':'telugu', 'ml':'malayalam', 'kn':'kannada', 'bn':'bengali', 'mr':'marathi', 'pa':'punjabi'}

            lang = 'http://www.imdb.com/title/%s/' % imdb
            lang = client.request(lang)
            lang = re.findall('href\s*=\s*[\'|\"](.+?)[\'|\"]', lang)
            lang = [i for i in lang if 'primary_language' in i]
            lang = [urlparse.parse_qs(urlparse.urlparse(i).query) for i in lang]
            lang = [i['primary_language'] for i in lang if 'primary_language' in i]
            lang = langMap[lang[0][0]]

            q = self.search_link % (lang, urllib.quote_plus(title))
            q = urlparse.urljoin(self.base_link, q)

            t = cleantitle.get(title)

            r = self.request(q)

            r = client.parseDOM(r, 'li')
            r = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'h3'), client.parseDOM(i, 'div', attrs = {'class': 'info'})) for i in r]
            r = [(i[0][0], i[1][0], i[2][0]) for i in r if i[0] and i[1] and i[2]]
            r = [(re.findall('(\d+)', i[0]), i[1], re.findall('(\d{4})', i[2])) for i in r]
            r = [(i[0][0], i[1], i[2][0]) for i in r if i[0] and i[2]]
            r = [i[0] for i in r if t == cleantitle.get(i[1]) and year == i[2]][0]

            url = str(r)
            return url
        except:
            return
Exemple #18
0
    def movie(self, imdb, title, year):
        try:
            query = self.search_link % (urllib.quote_plus(title))
            query = urlparse.urljoin(self.base_link, query)

            t = cleantitle.get(title)

            r = client.request(query)

            r = client.parseDOM(r, 'div', attrs={'class': 'cell_container'})
            r = [(client.parseDOM(i, 'a', ret='href'),
                  client.parseDOM(i, 'a', ret='title')) for i in r]
            r = [(i[0][0], i[1][0]) for i in r
                 if len(i[0]) > 0 and len(i[1]) > 0]
            r = [(i[0], re.findall('(.+?) \((\d{4})', i[1])) for i in r]
            r = [(i[0], i[1][0][0], i[1][0][1]) for i in r if len(i[1]) > 0]
            r = [
                i[0] for i in r if t == cleantitle.get(i[1]) and year == i[2]
            ][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Exemple #19
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

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

            h = {'X-Requested-With': 'XMLHttpRequest'}

            try: post = urlparse.parse_qs(urlparse.urlparse(referer).query).values()[0][0]
            except: post = referer.strip('/').split('/')[-1].split('watch_', 1)[-1].rsplit('#')[0].rsplit('.')[0]

            post = urllib.urlencode({'v': post})

            url = urlparse.urljoin(self.base_link, '/video_info/iframe')

            r = client.request(url, post=post, headers=h, referer=url)
            r = json.loads(r).values()
            r = [urllib.unquote(i.split('url=')[-1])  for i in r]

            for i in r:
                try: sources.append({'source': 'gvideo', 'quality': directstream.googletag(i)[0]['quality'], 'language': 'en', 'url': i, 'direct': True, 'debridonly': False})
                except: pass

            return sources
        except:
            return sources
Exemple #20
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        try:
            if url == None: return

            tv_maze = tvmaze.tvMaze()
            num = tv_maze.episodeAbsoluteNumber(tvdb, int(season),
                                                int(episode))
            num = str(num)

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

            r = client.request(url)
            r = r.decode('iso-8859-1').encode('utf-8')

            r = client.parseDOM(r, 'tr', attrs={'class': ''})
            r = [(client.parseDOM(i, 'a', ret='href'),
                  client.parseDOM(i, 'td', attrs={'class': 'epnum'}))
                 for i in r]
            r = [(i[0][0], i[1][0]) for i in r
                 if len(i[0]) > 0 and len(i[1]) > 0]
            r = [i[0] for i in r if num == i[1]][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Exemple #21
0
 def resolve(self, url):
     try:
         url = client.request(urlparse.urljoin(self.base_link, url),
                              output='geturl')
         return url if self.base_link not in url else None
     except:
         return
Exemple #22
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:
            if url == None:
                return sources

            query = urlparse.urljoin(
                self.base_link,
                self.get_link % (re.findall('-id(.*?)$', url)[0]))
            header = {
                'X-Requested-With': 'XMLHttpRequest',
                'Content-Type':
                'application/x-www-form-urlencoded; charset=UTF-8'
            }

            r = client.request(query, post='', headers=header)
            r = json.loads(r)
            r = [i[1] for i in r.items()]

            for i in r:
                if isinstance(i, list):
                    for urlData in i:
                        sources.append({
                            'source':
                            'gvideo',
                            'quality':
                            directstream.googletag(
                                urlData['link_mp4'])[0]['quality'],
                            'provider':
                            'MeinKino',
                            'language':
                            'de',
                            'url':
                            urlData['link_mp4'],
                            'direct':
                            True,
                            'debridonly':
                            False
                        })
                elif isinstance(i, dict):
                    for key, value in i.iteritems():
                        host = re.findall(
                            '([\w]+[.][\w]+)$',
                            urlparse.urlparse(value.strip().lower()).netloc)[0]
                        if not host in hostDict: continue

                        sources.append({
                            'source': host,
                            'quality': 'SD',
                            'provider': 'MeinKino',
                            'language': 'de',
                            'url': value,
                            'direct': False,
                            'debridonly': False
                        })

            return sources
        except:
            return sources
Exemple #23
0
    def movie(self, imdb, title, year):
        try:
            if debrid.status() == False: raise Exception()

            t = cleantitle.get(title)

            headers = {'X-Requested-With': 'XMLHttpRequest'}

            query = self.search_link + urllib.quote_plus(title)
            query = urlparse.urljoin(self.base_link, query)

            r = client.request(query, headers=headers)
            r = json.loads(r)

            r = [
                i for i in r
                if 'category' in i and 'movie' in i['category'].lower()
            ]
            r = [(i['url'], i['label']) for i in r
                 if 'label' in i and 'url' in i]
            r = [(i[0], re.findall('(.+?) \((\d{4})', i[1])) for i in r]
            r = [(i[0], i[1][0][0], i[1][0][1]) for i in r if len(i[1]) > 0]
            r = [
                i[0] for i in r if t == cleantitle.get(i[1]) and year == i[2]
            ][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Exemple #24
0
    def __search(self, title, year, season='0', episode=False):
        try:
            query = self.search_link % (urllib.quote_plus(cleantitle.query(title)))
            query = urlparse.urljoin(self.base_link, query)

            t = cleantitle.get(title)
            y = ['%s' % str(year), '%s' % str(int(year) + 1), '%s' % str(int(year) - 1), '0']

            r = client.request(query)

            r = client.parseDOM(r, 'ul', attrs={'class': 'products row'})
            r = client.parseDOM(r, 'div', attrs={'class': 'box-product clearfix'})
            r = client.parseDOM(r, 'h3', attrs={'class': 'title-product'})
            r = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a')) for i in r]
            r = [(i[0][0], i[1][0].lower()) for i in r if len(i[0]) > 0 and len(i[1]) > 0]
            r = [(i[0], i[1], re.findall('(.+?) \(*(\d{4})', i[1])) for i in r]
            r = [(i[0], i[2][0][0] if len(i[2]) > 0 else i[1], i[2][0][1] if len(i[2]) > 0 else '0') for i in r]
            r = [(i[0], i[1], i[2], re.findall('(.+?)\s+(?:staf+el|s)\s+(\d+)', i[1])) for i in r]
            r = [(i[0], i[3][0][0] if len(i[3]) > 0 else i[1], i[2], i[3][0][1] if len(i[3]) > 0 else '0') for i in r]
            r = [(i[0], i[1].replace(' hd', ''), i[2], i[3]) for i in r]
            r = [i[0] for i in r if t == cleantitle.get(i[1]) and i[2] in y and int(i[3]) == int(season)][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            url = url.replace('-info', '-stream')
            if episode: url = urlparse.urlparse(url).path + '?episode=%s' % int(episode)
            return url
        except:
            return
Exemple #25
0
    def movie(self, imdb, title, year):
        try:
            t = cleantitle.get(title)

            q = '/search/%s.html' % (urllib.quote_plus(
                cleantitle.query(title)))
            q = urlparse.urljoin(self.base_link, q)

            for i in range(3):
                r = client.request(q)
                if not r == None: break

            r = client.parseDOM(r, 'div', attrs={'class': 'ml-item'})
            r = [(client.parseDOM(i, 'a', ret='href'),
                  client.parseDOM(i, 'a', ret='title')) for i in r]
            r = [(i[0][0], i[1][0]) for i in r if i[0] and i[1]]
            r = [i[0] for i in r if t == cleantitle.get(i[1])][:2]
            r = [(i, re.findall('(\d+)', i)[-1]) for i in r]

            for i in r:
                try:
                    y, q = cache.get(self.ymovies_info, 9000, i[1])
                    if not y == year: raise Exception()
                    return urlparse.urlparse(i[0]).path
                except:
                    pass
        except:
            return
Exemple #26
0
    def __search(self, title):
        try:
            r = {'keyword': cleantitle.getsearch(title)}
            r = urllib.urlencode(r)
            r = client.request(urlparse.urljoin(self.base_link,
                                                self.search_link),
                               post=r)

            t = cleantitle.get(title)

            r = json.loads(r)
            r = [(i['link'], re.sub('<.+?>|</.+?>', '', i['title'])) for i in r
                 if 'title' in i and 'link' in i]
            r = [(i[0], i[1],
                  re.findall('(.+?)\s*Movie \d+:.+?$', i[1], re.DOTALL))
                 for i in r]
            r = [(i[0], i[2][0] if len(i[2]) > 0 else i[1]) for i in r]
            r = [i[0] for i in r if t == cleantitle.get(i[1])][0]

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Exemple #27
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

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

            result = client.request(url)
            result = re.sub(r'[^\x00-\x7F]+','', result)
            result = client.parseDOM(result, 'li')
            result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a')) for i in result]
            result = [i[0] for i in result if len(i[0]) > 0 and path in i[0][0] and len(i[1]) > 0 and 'Altyaz' in i[1][0]][0][0]

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

            result = client.request(url)
            result = re.sub(r'[^\x00-\x7F]+','', result)
            result = client.parseDOM(result, 'div', attrs = {'class': 'video-player'})[0]
            result = client.parseDOM(result, 'iframe', ret='src')[-1]

            try:
                url = base64.b64decode(urlparse.parse_qs(urlparse.urlparse(result).query)['id'][0])
                if not url.startswith('http'): raise Exception()
            except:
                url = client.request(result)
                url = urllib.unquote_plus(url.decode('string-escape'))
                frame = client.parseDOM(url, 'iframe', ret='src')
                if len(frame) > 0: url = [client.request(frame[-1], output='geturl')]
                else: url = re.compile('"(.+?)"').findall(url)
                url = [i for i in url if 'ok.ru' in i or 'vk.com' in i or 'openload.io' in i or 'openload.co' in i or 'oload.tv' in i][0]
                url = url.replace('openload.io', 'openload.co').replace('oload.tv', 'openload.co')

            try: url = 'http://ok.ru/video/%s' % urlparse.parse_qs(urlparse.urlparse(url).query)['mid'][0]
            except: pass

            if 'openload.co' in url: host = 'openload.co' ; direct = False ; url = [{'url': url, 'quality': 'HD'}]
            elif 'ok.ru' in url: host = 'vk' ; direct = True ; url = directstream.odnoklassniki(url)
            elif 'vk.com' in url: host = 'vk' ; direct = True ; url = directstream.vk(url)
            else: raise Exception()

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

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

            if url == None: return sources

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

            hostDict = [(i.rsplit('.', 1)[0], i) for i in hostDict]
            locDict = [i[0] for i in hostDict]

            result = client.request(url)
            result = result.decode('iso-8859-1').encode('utf-8')

            r = client.parseDOM(result, 'div', attrs={'class':
                                                      'player-embed'})[0]
            r = client.parseDOM(r, 'iframe', ret='src')[0]
            links = [(r, url)]

            r = client.parseDOM(result,
                                'div',
                                attrs={'class': 'generic-video-item'})
            r = [(i.split('</div>', 1)[-1].split()[0],
                  client.parseDOM(i, 'a', ret='href', attrs={'rel': '.+?'}))
                 for i in r]
            links += [(i[0], i[1][0]) for i in r if i[1]]

            for i in links:
                try:
                    try:
                        host = re.findall(
                            '([\w]+[.][\w]+)$',
                            urlparse.urlparse(i[0].strip().lower()).netloc)[0]
                    except:
                        host = i[0].lower()
                    host = host.rsplit('.', 1)[0]
                    if not host in locDict: raise Exception()
                    host = [x[1] for x in hostDict if x[0] == host][0]
                    host = host.encode('utf-8')

                    url = i[1]
                    url = urlparse.urljoin(self.base_link, url)
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    sources.append({
                        'source': host,
                        'quality': 'SD',
                        'language': 'en',
                        'url': url,
                        'direct': True,
                        'debridonly': False
                    })
                except:
                    pass

            return sources
        except:
            return sources
Exemple #29
0
 def __get_json(self, url):
     try:
         result = client.request(url)
         result = re.compile('var\s+subcats\s+=\s*(.*?);').findall(
             result)[0]
         return json.loads(result)
     except:
         return
Exemple #30
0
def odnoklassniki(url):
    try:
        url = re.compile('//.+?/.+?/([\w]+)').findall(url)[0]
        url = 'http://ok.ru/dk?cmd=videoPlayerMetadata&mid=%s' % url

        result = client.request(url)
        result = re.sub(r'[^\x00-\x7F]+', ' ', result)

        result = json.loads(result)['videos']

        try:
            hd = [{
                'quality': '1080p',
                'url': i['url']
            } for i in result if i['name'] == 'full']
        except:
            pass
        try:
            hd += [{
                'quality': 'HD',
                'url': i['url']
            } for i in result if i['name'] == 'hd']
        except:
            pass
        try:
            sd = [{
                'quality': 'SD',
                'url': i['url']
            } for i in result if i['name'] == 'sd']
        except:
            pass
        try:
            sd += [{
                'quality': 'SD',
                'url': i['url']
            } for i in result if i['name'] == 'low']
        except:
            pass
        try:
            sd += [{
                'quality': 'SD',
                'url': i['url']
            } for i in result if i['name'] == 'lowest']
        except:
            pass
        try:
            sd += [{
                'quality': 'SD',
                'url': i['url']
            } for i in result if i['name'] == 'mobile']
        except:
            pass

        url = hd + sd[:1]
        if not url == []: return url

    except:
        return