def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, 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
Example #2
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]

                    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 = '%s/movies/%s-%s/' % (self.base_link, cleantitle.geturl(data['title']), data['year'])

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

                    r = client.request(url)

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

                r = client.request(url)


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

            for i in r:
                try:
                    if '1080' in i[1]: quality = '1080p'
                    elif '720' in i[1]: quality = 'HD'
                    else: raise Exception()

                    url = i[0].replace('\/', '/')
                    url = client.replaceHTMLCodes(url)
                    if not '.php' in i[0]: raise Exception()
                    url = url.encode('utf-8')

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

            return sources
        except:
            return sources
    def movie(self, imdb, title, localtitle, year):
        try:
            url = self.search_link % (cleantitle.geturl(title), year)

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

            r = proxy.geturl(q)
            if not r == None: return url

            t = cleantitle.get(title)

            q = self.search_link_2 % urllib.quote_plus(cleantitle.query(title))
            q = urlparse.urljoin(self.base_link, q)

            r = client.request(q)

            r = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'a'))
            r = [(i[0], re.findall('(?:\'|\")(.+?)(?:\'|\")', i[1]))
                 for i in r]
            r = [(i[0], [re.findall('(.+?)\((\d{4})', x) for x in i[1]])
                 for i in r]
            r = [(i[0], [x[0] for x in i[1] if x]) for i in r]
            r = [(i[0], i[1][0][0], i[1][0][1]) for i in r if i[1]]
            r = [i[0] for i in r if t == cleantitle.get(i[1]) and year == i[2]]

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

            if url == None: return sources

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

            title = data['title']
            year = data['year']

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

            v = '%s_%s' % (cleantitle.geturl(title).replace('-', '_'), year)

            url = '/watch?v=%s' % v
            url = urlparse.urljoin(self.base_link, url)

            #c = client.request(url, headers=h, output='cookie')
            #c = client.request(urlparse.urljoin(self.base_link, '/av'), cookie=c, output='cookie', headers=h, referer=url)
            #c = client.request(url, cookie=c, headers=h, referer=url, output='cookie')

            post = urllib.urlencode({'v': v})
            u = urlparse.urljoin(self.base_link, '/video_info/iframe')

            #r = client.request(u, post=post, cookie=c, headers=h, XHR=True, referer=url)
            r = client.request(u, post=post, headers=h, XHR=True, 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
Example #5
0
    def movie(self, imdb, title, localtitle, year):
        try:
            url = self.search_link % (cleantitle.geturl(title), year)
            url = urlparse.urljoin(self.base_link, url)

            url = client.request(url, output='geturl')

            url = re.findall('(?://.+?|)(/.+)', url)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Example #6
0
    def movie(self, imdb, title, localtitle, year):
        try:
            url = self.search_link % (cleantitle.geturl(title), year)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url, limit='1')
            r = client.parseDOM(r, 'title')[0]
            if r == '': raise Exception()

            url = re.findall('(?://.+?|)(/.+)', url)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
 def searchMovie(self, title):
     try:
         title = cleantitle.normalize(title)
         url = urlparse.urljoin(self.base_link,
                                self.search_link % cleantitle.geturl(title))
         r = client.request(url, timeout='10')
         r = client.parseDOM(r, 'div', attrs={'class': 'ml-item'})
         r = zip(client.parseDOM(r, 'a', ret='href'),
                 client.parseDOM(r, 'h2'))
         r = [
             i[0] for i in r
             if cleantitle.get(title) == cleantitle.get(i[1])
         ][0]
         url = urlparse.urljoin(self.base_link, '%s/watching.html' % r)
         return url
     except:
         return
Example #8
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        try:
            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            url = '%s/watch/%s-season-%01d-%s.html' % (
                self.base_link, cleantitle.geturl(data['tvshowtitle']),
                int(season), str((int(data['year']) + int(season)) - 1))
            url = client.request(url, output='geturl')
            if url == None: raise Exception()

            url = re.findall('(?://.+?|)(/.+)', url)[0]
            url += '?episode=%01d' % int(episode)
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
Example #9
0
    def movie(self, imdb, title, localtitle, year):
        try:
            url = '%s/%s-%s/' % (self.base_link, cleantitle.geturl(title),
                                 year)

            url = client.request(url, output='geturl')

            if url == None: raise Exception()

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

        try:
            t = cleantitle.get(title)

            q = '%s %s' % (title, year)
            q = self.search_link.decode('base64') % urllib.quote_plus(q)

            r = client.request(q, error=True)

            r = json.loads(r)['results']
            r = [(i['url'], i['titleNoFormatting']) for i in r]
            r = [(i[0],
                  re.findall('(?:^Watch Movie |^Watch |)(.+?)\((\d{4})', i[1]))
                 for i in r]
            r = [(i[0], i[1][0][0], i[1][0][1]) for i in r if i[1]]
            r = [(urllib.unquote_plus(i[0]), i[1], i[2]) for i in r]
            r = [(urlparse.urlparse(i[0]).path, i[1], i[2]) for i in r]
            r = [i for i in r if t == cleantitle.get(i[1]) and year == i[2]]
            r = re.sub('/watch-movie-|-\d+$', '/', r[0][0].strip())

            url = re.findall('(?://.+?|)(/.+)', r)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            pass
Example #10
0
 def searchMovie(self, title, year):
     try:
         title = cleantitle.normalize(title)
         url = urlparse.urljoin(
             self.base_link, self.moviesearch_link %
             (cleantitle.geturl(title.replace('\'', '-'))))
         r = client.request(url)
         t = cleantitle.get(title)
         r = client.parseDOM(r, 'h2', attrs={'class': 'tit'})
         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 in cleantitle.get(i[1]) and year == i[2]
         ][0]
         url = re.findall('(?://.+?|)(/.+)', r)[0]
         url = client.replaceHTMLCodes(url)
         return url.encode('utf-8')
     except:
         return
Example #11
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, timeout='10', output='geturl')
                if url == None: raise Exception()

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

                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, timeout='10')

            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
Example #12
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])

                title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                    'title']

                imdb = data['imdb']
                year = data['year']

                if 'tvshowtitle' in data:
                    url = '%s/tv-show/%s/season/%01d/episode/%01d' % (
                        self.base_link, cleantitle.geturl(title),
                        int(data['season']), int(data['episode']))
                    result = client.request(url, limit='5')

                    if result == None:
                        t = cache.get(self.getImdbTitle, 900, imdb)
                        if title != t:
                            url = '%s/tv-show/%s/season/%01d/episode/%01d' % (
                                self.base_link, cleantitle.geturl(t),
                                int(data['season']), int(data['episode']))
                            result = client.request(url, limit='5')
                else:
                    url = '%s/movie/%s' % (self.base_link,
                                           cleantitle.geturl(title))
                    result = client.request(url, limit='5')

                    if result == None:
                        t = cache.get(self.getImdbTitle, 900, imdb)
                        if title != t:
                            url = '%s/movie/%s' % (self.base_link,
                                                   cleantitle.geturl(t))
                            result = client.request(url, limit='5')

                if result == None and not 'tvshowtitle' in data:
                    url += '-%s' % year
                    result = client.request(url, limit='5')

                result = client.parseDOM(result, 'title')[0]

                if '%TITLE%' in result: raise Exception()

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

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

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

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

            cookie = r[4]
            headers = r[3]
            result = r[0]

            try:
                auth = re.findall('__utmx=(.+)', cookie)[0].split(';')[0]
            except:
                auth = 'false'
            auth = 'Bearer %s' % urllib.unquote_plus(auth)

            headers['Authorization'] = auth
            headers[
                'Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
            headers[
                'Accept'] = 'application/json, text/javascript, */*; q=0.01'
            headers['Cookie'] = cookie
            headers['Referer'] = url

            u = '/ajax/jne.php'
            u = urlparse.urljoin(self.base_link, u)

            action = 'getEpisodeEmb' if '/episode/' in url else 'getMovieEmb'

            elid = urllib.quote(
                base64.encodestring(str(int(time.time()))).strip())

            token = re.findall("var\s+tok\s*=\s*'([^']+)", result)[0]

            idEl = re.findall('elid\s*=\s*"([^"]+)', result)[0]

            post = {
                'action': action,
                'idEl': idEl,
                'token': token,
                'elid': elid
            }
            post = urllib.urlencode(post)

            c = client.request(u,
                               post=post,
                               headers=headers,
                               XHR=True,
                               output='cookie',
                               error=True)

            headers['Cookie'] = cookie + '; ' + c

            r = client.request(u, post=post, headers=headers, XHR=True)
            r = str(json.loads(r))
            r = re.findall('\'(http.+?)\'', r) + re.findall('\"(http.+?)\"', 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
Example #13
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            choice = random.choice(self.random_link)
            base_link = 'http://%s' % choice
            strm_link = 'http://play.%s' % choice + '/grabber-api/episode/%s?token=%s'

            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])

                title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                    'title']

                if 'tvshowtitle' in data:
                    url = '/tv-series/%s-season-%01d/watch/' % (
                        cleantitle.geturl(title), int(data['season']))
                    year = str((int(data['year']) + int(data['season'])) - 1)
                    episode = '%01d' % int(data['episode'])

                else:
                    url = '/movie/%s/watch/' % cleantitle.geturl(title)
                    year = data['year']
                    episode = None

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

                r = client.request(url)

                y = re.findall('Release\s*:\s*.+?\s*(\d{4})', r)[0]

                if not year == y: raise Exception()
            else:
                try:
                    url, episode = re.findall('(.+?)\?episode=(\d*)$', url)[0]
                except:
                    episode = None

                url = urlparse.urljoin(base_link, url)
                url = re.sub('/watch$', '', url.strip('/')) + '/watch/'
                referer = url

                r = client.request(url)

            r = client.parseDOM(r, 'div', attrs={'class': 'les-content'})
            r = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'a'))
            r = [(i[0], ''.join(re.findall('(\d+)', i[1])[:1])) for i in r]

            if not episode == None:
                r = [i[0] for i in r if '%01d' % int(i[1]) == episode]
            else:
                r = [i[0] for i in r]

            r = [i for i in r if '/server-' in i]

            for u in r:
                try:
                    p = client.request(u, referer=referer, timeout='10')

                    t = re.findall('player_type\s*:\s*"(.+?)"', p)[0]
                    if t == 'embed': raise Exception()

                    s = client.parseDOM(p,
                                        'input',
                                        ret='value',
                                        attrs={'name': 'episodeID'})[0]
                    t = ''.join(
                        random.sample(
                            string.digits + string.ascii_uppercase +
                            string.ascii_lowercase, 8))
                    k = hashlib.md5('!@#$%^&*(' + s + t).hexdigest()
                    v = hashlib.md5(t + referer + s).hexdigest()

                    stream = strm_link % (s, t)
                    cookie = '%s=%s' % (k, v)

                    u = client.request(stream,
                                       referer=referer,
                                       cookie=cookie,
                                       timeout='10')

                    u = json.loads(u)['playlist'][0]['sources']
                    u = [i['file'] for i in u if 'file' in i]

                    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
    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/film/%s-season-%01d/watching.html' % (
                        self.base_link, cleantitle.geturl(
                            data['tvshowtitle']), int(data['season']))
                    url = client.request(url, timeout='10', output='geturl')

                    if url == None:
                        url = self.searchShow(data['tvshowtitle'],
                                              data['season'])

                    if url == None:
                        t = cache.get(self.getImdbTitle, 900, data['imdb'])
                        if data['tvshowtitle'] != t:
                            url = self.searchShow(t, data['season'])

                else:
                    url = '%s/film/%s/watching.html' % (
                        self.base_link, cleantitle.geturl(data['title']))
                    url = client.request(url, timeout='10', output='geturl')

                    if url == None:
                        url = self.searchMovie(data['title'])

                    if url == None:
                        t = cache.get(self.getImdbTitle, 900, data['imdb'])
                        if data['title'] != t:
                            url = self.searchMovie(t)

                if url == None: raise Exception()

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

            r = client.request(url, timeout='10')
            r = client.parseDOM(r, 'div', attrs={'class': 'les-content'})
            if 'tvshowtitle' in data:
                ep = data['episode']
                links = client.parseDOM(r,
                                        'a',
                                        attrs={'episode-data': ep},
                                        ret='player-data')
            else:
                links = client.parseDOM(r, 'a', ret='player-data')

            for link in links:
                if '123movieshd' in link or 'seriesonline' in link:
                    r = client.request(link, timeout='10')
                    r = re.findall('(https:.*?redirector.*?)[\'\"]', 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
                else:
                    try:
                        host = re.findall(
                            '([\w]+[.][\w]+)$',
                            urlparse.urlparse(link.strip().lower()).netloc)[0]
                        if not host in hostDict: raise Exception()
                        host = client.replaceHTMLCodes(host)
                        host = host.encode('utf-8')

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

            return sources
        except:
            return sources