コード例 #1
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
コード例 #2
0
    def sources(self, url, hostDict, hostprDict):
        try:
            self._sources = []
            self.items = []
            if url is None:
                return self._sources

            if debrid.status() is False:
                raise Exception()

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

            self.title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
            self.hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            url = self.search.format(urllib.quote(query))

            self._get_items(url)
            self.hostDict = hostDict + hostprDict
            threads = []
            for i in self.items:
                threads.append(workers.Thread(self._get_sources, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            return self._sources
        except BaseException:
            return self._sources
コード例 #3
0
ファイル: scnsrc.py プロジェクト: YourFriendCaspian/dotfiles
    def sources(self, url, hostDict, hostprDict):
        try:
            self._sources = []
            if url is None: return self._sources

            if debrid.status() is False: raise Exception()

            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']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            query = cleantitle.geturl(query)
            url = urlparse.urljoin(self.base_link, query)

            headers = {'User-Agent': client.agent()}
            r = client.request(url, headers=headers)
            posts = dom_parser2.parse_dom(r, 'li', {'class': re.compile('.+?'), 'id': re.compile('comment-.+?')})
            self.hostDict = hostDict + hostprDict
            threads = []

            for i in posts: threads.append(workers.Thread(self._get_sources, i.content))
            [i.start() for i in threads]
            [i.join() for i in threads]

            return self._sources
        except Exception:
            return self._sources
コード例 #4
0
ファイル: dltube.py プロジェクト: amadu80/repository.xvbmc
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            r = client.request(url)

            r = client.parseDOM(r, 'input', {'id': 'movie_id'}, ret='value')
            if r:
                r = client.request(urlparse.urljoin(self.base_link, self.download_link), post='movie=%s' % r, referer=url)

            links = client.parseDOM(r, 'p')

            hostDict = hostprDict + hostDict

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


            for link in links:
                try:
                    host = re.findall('Downloads-Server(.+?)(?:\'|\")\)', link)[0]
                    host = host.strip().lower().split()[-1]
                    if host == 'fichier': host = '1fichier'
                    host = [x[1] for x in locDict if host == x[0]][0]
                    if not host in hostDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    url = client.parseDOM(link, 'a', ret='href')[0]
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    r = client.parseDOM(link, 'a')[0]

                    fmt = r.strip().lower().split()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'HD'

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) [M|G]B)', r)[-1]
                        div = 1 if size.endswith(' GB') else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                        info = '%.2f GB' % size
                    except:
                        info = ''

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

            return sources
        except:
            return sources
コード例 #5
0
ファイル: ultrahd.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() is False: raise Exception()

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

            title = data['title'].replace(':','').lower()
            year = data['year']

            query = '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

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

            post = 'do=search&subaction=search&search_start=0&full_search=0&result_from=1&story=%s' % urllib.quote_plus(query)

            r = client.request(url, post=post)
            r = client.parseDOM(r, 'div', attrs={'class': 'box-out margin'})
            r = [(dom_parser2.parse_dom(i, 'div', attrs={'class':'news-title'})) for i in r if data['imdb'] in i]
            r = [(dom_parser2.parse_dom(i[0], 'a', req='href')) for i in r if i]
            r = [(i[0].attrs['href'], i[0].content) for i in r if i]

            hostDict = hostprDict + hostDict

            for item in r:
                try:
                    name = item[1]
                    y = re.findall('\((\d{4})\)', name)[0]
                    if not y == year: raise Exception()

                    s = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', name)
                    s = s[0] if s else '0'
                    data = client.request(item[0])
                    data = dom_parser2.parse_dom(data, 'div', attrs={'id': 'r-content'})
                    data = re.findall('\s*<b><a href=.+?>(.+?)</b>.+?<u><b><a href="(.+?)".+?</a></b></u>',
                                      data[0].content, re.DOTALL)
                    u = [(i[0], i[1], s) for i in data if i]

                    for name, url, size in u:
                        try:
                            if '4K' in name:
                                quality = '4K'
						    elif '2160p' in name:
                                quality = '4K'
							elif '1440p' in name:
                                quality = '4K'
                            elif '1080p' in name:
                                quality = '1080p'
                            elif '720p' in name:
                                quality = '720p'
                            elif any(i in ['dvdscr', 'r5', 'r6'] for i in name):
                                quality = 'SCR'
コード例 #6
0
ファイル: zoogle.py プロジェクト: vphuc81/MyRepository
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        if debrid.status(True) is False:
            return

        try:
            url = {'imdb': imdb, 'tvdb': tvdb, 'tvshowtitle': tvshowtitle, 'year': year}
            url = urllib.urlencode(url)
            return url
        except Exception:
            
            return
コード例 #7
0
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        if debrid.status(True) is False:
            return

        try:
            url = {'imdb': imdb, 'tvdb': tvdb, 'tvshowtitle': tvshowtitle, 'year': year}
            url = urllib.urlencode(url)
            return url
        except Exception:
            failure = traceback.format_exc()
            log_utils.log('TPB - Exception: \n' + str(failure))
            return
コード例 #8
0
ファイル: allrls.py プロジェクト: CYBERxNUKE/xbmc-addon
 def movie(self, imdb, title, localtitle, aliases, year):
     try:
         if debrid.status() == False: raise Exception()
         url = urlparse.urljoin(self.base_link, '%s-%s' % (cleantitle.geturl(title), year))
         url = client.request(url, output='geturl')
         if url == None: 
             url = urlparse.urljoin(self.base_link, '%s' % (cleantitle.geturl(title)))
             url = client.request(url, output='geturl')
         if url == None: raise Exception()
         return url
     except:
         return
コード例 #9
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if debrid.status() == False: raise Exception()
         r = self.scraper.get(url).content
         r = re.findall('<iframe src="(.+?)"', r)
         for url in r:
             valid, host = source_utils.is_host_valid(url, hostDict)
             quality = source_utils.check_sd_url(url)
             sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'direct': False, 'debridonly': False})
         return sources
     except:
         return
コード例 #10
0
ファイル: ddls.py プロジェクト: azumimuo/family-xbmc-addon
    def sources(self, url, hostDict, hostprDict):
        try:
			sources = []

			if url == None: return sources

			if debrid.status() == False: raise Exception()

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

			title = data['tvshowtitle']
			season = '%01d' % int(data['season'])
			episode = '%02d' % int(data['episode'])

			r = cache.get(self.ddlseries_tvcache, 120)

			r = [(i[0], i[3]) for i in r if cleantitle.get(title) == cleantitle.get(i[1]) and season == i[2]]

			links = []

			for url, quality in r:
				try:
					link = client.request(url)
					vidlinks = client.parseDOM(link, 'span', attrs = {'class': 'overtr'})[0]
					match = re.compile('href="([^"]+)[^>]*>\s*Episode\s+(\d+)<').findall(vidlinks)
					match = [(i[0], quality) for i in match if episode == i[1]]
					links += match
				except:
					pass

			for url, quality in links:
				try:
					if "protect-links" in url:
						redirect = client.request(url)
						url = re.findall('<a href="(.*?)" target="_blank">', redirect)
						url = url[0]

					host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
					if not host in hostprDict: raise Exception()
					host = client.replaceHTMLCodes(host)
					host = host.encode('utf-8')

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

			return sources
        except:
            return sources
コード例 #11
0
ファイル: zoogle.py プロジェクト: vphuc81/MyRepository
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        if debrid.status(True) is False:
            return

        try:
            if url is None:
                return

            url = urlparse.parse_qs(url)
            url = dict([(i, url[i][0]) if url[i] else (i, '') for i in url])
            url['title'], url['premiered'], url['season'], url['episode'] = title, premiered, season, episode
            url = urllib.urlencode(url)
            return url
        except Exception:
            
            return
コード例 #12
0
ファイル: glodls.py プロジェクト: YourFriendCaspian/dotfiles
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                raise Exception()

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

            self.title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
            self.hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            if 'tvshowtitle' in data:
                url = self.tvsearch.format(urllib.quote_plus(query))
                url = urlparse.urljoin(self.base_link, url)

            else:
                url = self.moviesearch.format(urllib.quote_plus(query))
                url = urlparse.urljoin(self.base_link, url)

            items = self._get_items(url)

            hostDict = hostDict + hostprDict
            for item in items:
                try:
                    name = item[0]
                    quality, info = source_utils.get_release_quality(name, name)
                    info.append(item[2])
                    info = ' | '.join(info)
                    url = item[1]
                    url = url.split('&tr')[0]

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

            return sources
        except BaseException:
            return sources
コード例 #13
0
    def sources(self, url, hostDict, hostprDict):
        sources = []

        try:

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            data = url

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = requests.get(url).text
            posts = re.findall(r'(?s)<item>(.*?)</item>', r)

            hostDict = hostprDict + hostDict

            items = []
            for post in posts:
                try:
                    title = re.findall(r'<title>(.*?)</title>', post)[0]
                    if query.lower() in title.lower():
                        linksDivs = re.findall(r'(?s)<singlelink></singlelink><br />(.*?)<br />.<strong>', post)
                        for div in linksDivs:
                            links = re.findall(r'<a href="(.*?)"', div)
                            for link in links:
                                quality = source_utils.get_quality_simple(link)
                                valid, host = source_utils.is_host_valid(link, hostDict)
                                if valid:
                                    sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': link, 'info': '', 'direct': False, 'debridonly': True})

                except:
                    traceback.print_exc()
                    pass
            return sources
        except:
            traceback.print_exc()
            return sources
コード例 #14
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        if debrid.status(True) is False:
            return

        try:
            if url is None:
                return

            url = urlparse.parse_qs(url)
            url = dict([(i, url[i][0]) if url[i] else (i, '') for i in url])
            url['title'], url['premiered'], url['season'], url['episode'] = title, premiered, season, episode
            url = urllib.urlencode(url)
            return url
        except Exception:
            failure = traceback.format_exc()
            log_utils.log('TPB - Exception: \n' + str(failure))
            return
コード例 #15
0
ファイル: dltube.py プロジェクト: vphuc81/MyRepository
    def movie(self, imdb, title, localtitle, aliases, year):
        try:
            if debrid.status() == False: raise Exception()

            query = self.search_link % (self.base_link, urllib.quote_plus(title).replace('+', '-'))
            html = client.request(query, XHR=True)

            results = re.compile('<ul id=first-carousel1(.+?)</ul>',re.DOTALL).findall(html)
            result = re.compile('alt="(.+?)".+?<h2><a href="(.+?)".+?</h2>.+?>(.+?)</p>',re.DOTALL).findall(str(results))

            for found_title,url,date in result:
                new_url = self.base_link + url
                if cleantitle.get(title) in cleantitle.get(found_title):
                    if year in date:
                        return new_url
        except:
            return
コード例 #16
0
ファイル: 2ddl.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url == None: return sources

            if debrid.status() is False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            html = client.request(url)
            url_list = re.compile('<h2><a href="([^"]+)"',re.DOTALL).findall(html)

            hostDict = hostprDict + hostDict

            for url in url_list:
                if cleantitle.get(title) in cleantitle.get(url):
                    html = client.request(url)
                    links = re.compile('href="([^"]+)" rel="nofollow"',re.DOTALL).findall(html)
                    for vid_url in links:
                        if 'ouo.io' in vid_url:
                            continue
                        if 'sh.st' in vid_url:
                            continue
                        if 'linx' in vid_url:
                            log_utils.log('2DDL - sources - linx: ' + str(vid_url))
                            continue
                        if '.rar' not in vid_url:
                            if '.srt' not in vid_url:
                                'SD',info = source_utils.get_release_quality(url, vid_url)
                                host = vid_url.split('//')[1].replace('www.','')
                                host = host.split('/')[0].lower()
                                sources.append({'source': host, 'quality': 'SD', 'language': 'en', 'url': vid_url, 'info': info, 'direct': False, 'debridonly': False})
            return sources
        except Exception, argument:
            return sources  
コード例 #17
0
ファイル: seriescr.py プロジェクト: CYBERxNUKE/xbmc-addon
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None: return sources

            if debrid.status() is False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode']))
            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode']))
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            url = self.search_link % urllib.quote_plus(query)
            r = urlparse.urljoin(self.base_link, url)
            r = client.request(r)
            r = client.parseDOM(r, 'item')
            title = client.parseDOM(r, 'title')[0]
            if hdlr in title:
                r = re.findall('<h3.+?>(.+?)</h3>\s*<h5.+?<strong>(.+?)</strong.+?h3.+?adze.+?href="(.+?)">.+?<h3', r[0], re.DOTALL)
                for name, size, url in r:
                    quality, info = source_utils.get_release_quality(name, url)
                    try:
                        size = re.sub('i', '', size)
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    info = ' | '.join(info)

                    valid, host = source_utils.is_host_valid(url, hostDict)
                    sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info,
                                    'direct': False, 'debridonly': True})


            return sources
        except:
            return sources
コード例 #18
0
ファイル: tvrelease.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):

        try:
            self.validHosts = hostprDict + hostDict

            sources = []

            if url == None: return sources
            print('URL INFO - ' + str(url))

            if not debrid.status(): raise Exception()

            if 'tvshowtitle' in url:
                url['season'] = '%02d' % int(url['season'])
                url['episode'] = '%02d' % int(url['episode'])
                query = '%s S%sE%s' % (url['tvshowtitle'], url['season'], url['episode'])
            else:
                query = '%s %s' % (url['title'], url['year'])

                query = urlencode(query)

            url = self.search_link % query
            url = urlparse.urljoin(self.base_link, url)

            r = self.scraper.get(url)

            r = BeautifulSoup(r.text, 'html.parser')
            posts = r.findAll('h2')
            for post in posts:
                if query.lower() in post.text.lower():
                    postLink = post.find('a')['href']
                    self.threads.append(Thread(target=self.getPost, args=(postLink,)))

            for i in self.threads:
                i.start()
            for i in self.threads:
                i.join()

            return self.sourceList
        except:
            traceback.print_exc()
コード例 #19
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if debrid.status() == False: raise Exception()
         scraper = cfscrape.create_scraper()
         r = scraper.get(url).content
         try:
             qual = re.compile('class="quality">(.+?)<').findall(r)
             print qual
             for i in qual:
                 if 'HD' in i:
                     quality = '1080p'
                 else:
                     quality = 'SD'
             match = re.compile('<iframe src="(.+?)"').findall(r)
             for url in match:
                 valid, host = source_utils.is_host_valid(url, hostDict)
                 sources.append({'source': host,'quality': quality,'language': 'en','url': url,'direct': False,'debridonly': False})
         except:
             return
     except Exception:
         return
     return sources
コード例 #20
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources
            if debrid.status() == False: raise Exception()

            hostDict = hostprDict + hostDict
            pages = url
            for page_url in pages:
                r = client.request(page_url)
                urls = client.parseDOM(r, 'a', ret = 'href')
                for url in urls:
                    try:
                        host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                        if not host in hostDict: raise Exception()

                        if any(x in url for x in ['.rar', '.zip', '.iso']): continue

                        quality, infoo = source_utils.get_release_quality(url)

                        info = []

                        if any(x in url.upper() for x in ['HEVC', 'X265', 'H265']): info.append('HEVC')

                        info = ' | '.join(info)

                        host = client.replaceHTMLCodes(host)
                        host = host.encode('utf-8')
                        sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True})
                    except:
                        pass
            return sources
        except:
            failure = traceback.format_exc()
            log_utils.log('ALLRLS - Exception: \n' + str(failure))
            return sources
コード例 #21
0
    def sources(self, url, hostDict, hostprDict):
        try:
            self._sources = []
            if url is None:
                return self._sources

            if debrid.status() is False:
                raise Exception()

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

            self.title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
            self.hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub(r'(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            if 'tvshowtitle' in data:
                url = self.search.format('8', urllib.quote(query))
            else:
                url = self.search.format('4', urllib.quote(query))

            self.hostDict = hostDict + hostprDict
            headers = {'User-Agent': client.agent()}
            _html = client.request(url, headers=headers)
            threads = []
            for i in re.findall(r'<item>(.+?)</item>', _html, re.DOTALL):
                threads.append(workers.Thread(self._get_items, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

            return self._sources
        except BaseException:
            return self._sources
コード例 #22
0
ファイル: dltube.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url == None: return sources
            if debrid.status() == False: raise Exception()

            r = client.request(url)
            mov_id = re.compile('id=movie value=(.+?)/>',re.DOTALL).findall(r)[0]
            mov_id = mov_id.rstrip()
            headers = {'Origin':'https://mydownloadtube.to', 'Referer':url,
                       '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'}
            request_url = 'https://mydownloadtube.to/movies/play_online' 
            form_data = {'movie':mov_id}
            links_page = client.request(request_url, headers=headers, post=form_data)
            matches = re.compile("sources:(.+?)controlbar",re.DOTALL).findall(links_page)
            match = re.compile("file:window.atob.+?'(.+?)'.+?label:\"(.+?)\"",re.DOTALL).findall(str(matches))
            for link,res in match:
                vid_url = base64.b64decode(link).replace(' ','%20')
                res = res.replace('3Dp','3D').replace(' HD','')
                sources.append({'source': 'DirectLink', 'quality': res, 'language': 'en', 'url': vid_url, 'info': '', 'direct': True, 'debridonly': False})

            match2 = re.compile('<[iI][fF][rR][aA][mM][eE].+?[sS][rR][cC]="(.+?)"',re.DOTALL).findall(links_page)
            for link in match2:
                host = link.split('//')[1].replace('www.','')
                host = host.split('/')[0].split('.')[0].title()
                if '1080' in link:
                    res='1080p'
                elif '720' in link:
                    res='720p'
                else:res = 'SD',
                if 'flashx' not in link:
                    sources.append({'source': host, 'quality': res, 'language': 'en', 'url': link, 'info': 'AC3', 'direct': False, 'debridonly': False})

            return sources
        except:
            return sources
コード例 #23
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            dt = int(datetime.datetime.now().strftime('%Y%m%d'))
            mt = {'jan':'1', 'feb':'2', 'mar':'3', 'apr':'4', 'may':'5', 'jun':'6', 'jul':'7', 'aug':'8', 'sep':'9', 'oct':'10', 'nov':'11', 'dec':'12'}

            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']
            hdlr = ['S%02dE%02d' % (int(data['season']), int(data['episode']))] if 'tvshowtitle' in data else ['%s' % str(data['year'])]

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            query = self.search_link % urllib.quote_plus(query)
            query = urlparse.urljoin(self.base_link, query)

            result = client.request(query)

            result = client.parseDOM(result, 'div', attrs = {'id': 'post-\d+'})
            result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a'), client.parseDOM(i, 'a', attrs = {'title': 'posting time.+?'}), client.parseDOM(i, 'a', attrs = {'rel': 'category tag'})) for i in result]
            result = [(i[0][0], i[1][0], i[2][0], i[3]) for i in result if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0 and len(i[3]) > 0]

            result = [(i[0], i[1], i[2], i[3]) for i in result if 'Single Link' in i[3]]
            result = [(i[0], i[1], i[2], i[3]) for i in result if any(x in ['720P', '1080P', 'TV 1080p', 'TV 720p'] for x in i[3])]
            if not 'tvshowtitle' in data: result = [(i[0], i[3], i[1], i[2]) for i in result if 'Movies' in i[3] and not any(x in ['BDRip', 'Cam', 'CAMRip', 'HDCAM', 'HDScr', 'DVDR', 'DVDRip', 'DVDScr', 'R6', 'Telesync', 'Extras', '3D'] for x in i[3])]
            else: result = [(i[0], i[3], i[1], i[2]) for i in result if 'TV Shows' in i[3] and not 'TV Packs' in i[3]]

            result = [(i[0], i[1], i[2], re.findall('(\w+).+?(\d+).+?(\d*)', i[3])) for i in result]
            result = [(i[0], i[1], i[2], '%04d%02d%02d' % (int('20' + i[3][0][2][-2:]), int(mt[i[3][0][0][:3].lower()]), int(i[3][0][1]))) for i in result if len(i[3]) > 0]
            result = [(i[0], i[1], i[2], (abs(dt - int(i[3])) < control.integer * 10)) for i in result]
            result = [(i[0], i[1], i[2]) for i in result if i[3] == True]

            result = [(i[0], i[1], i[2].upper()) for i in result]
            result = [(i[0], i[1], re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|3D)(\.|\)|\]|\s|)(.+|)', '', i[2]), re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*)[\.|\)|\]|\s|]', i[2])) for i in result]
            result = [(i[0], i[1], i[2]) for i in result if len(i[3]) > 0 and any(x in i[3][0] for x in hdlr)]
            result = [(i[0], i[1]) for i in result if cleantitle.get(title) == cleantitle.get(i[2])]


            r = [(i[0], '1080p') for i in result if any(x in ['1080P', 'TV 1080p'] for x in i[1])][:2]
            r += [(i[0], 'HD') for i in result if any(x in ['720P', 'TV 720p'] for x in i[1])][:2]
            result = r

            links = []

            for i in result:
                try:
                    r = client.replaceHTMLCodes(i[0])
                    r = client.request(r)
                    r = client.parseDOM(r, 'p')
                    r = [(client.parseDOM(x, 'a', attrs = {'rel': 'nofollow'}), client.parseDOM(x, 'strong')) for x in r]
                    r = [(x[0], len(x[0]), len(x[1])) for x in r]
                    r = [x[0] for x in r if len(x[0]) > 0 and x[1] == x[2]]
                    r = sum(r, [])
                    for url in r: links.append({'url': url, 'quality': i[1]})
                except:
                    pass

            for i in links:
                try:
                    url = i['url']
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostprDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({'source': host, 'quality': i['quality'], 'provider': 'twoDDL', 'url': url, 'direct': False, 'debridonly': True})
                except:
                    pass

            return sources
        except:
            return sources
コード例 #24
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            r = client.request(url)

            r = client.parseDOM(r, 'input', {'id': 'movie_id'}, ret='value')
            if r:
                r = client.request(urlparse.urljoin(self.base_link,
                                                    self.download_link),
                                   post='movie=%s' % r,
                                   referer=url)

            links = client.parseDOM(r, 'p')

            hostDict = hostprDict + hostDict

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

            for link in links:
                try:
                    host = re.findall('Downloads-Server(.+?)(?:\'|\")\)',
                                      link)[0]
                    host = host.strip().lower().split()[-1]
                    if host == 'fichier': host = '1fichier'
                    host = [x[1] for x in locDict if host == x[0]][0]
                    if not host in hostDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    url = client.parseDOM(link, 'a', ret='href')[0]
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    r = client.parseDOM(link, 'a')[0]

                    fmt = r.strip().lower().split()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'HD'

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) [M|G]B)',
                                          r)[-1]
                        div = 1 if size.endswith(' GB') else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        info = '%.2f GB' % size
                    except:
                        info = ''

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

            return sources
        except:
            return sources
コード例 #25
0
ファイル: bestmoviez.py プロジェクト: ddueces/Build
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s s%02de%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)

            posts = client.parseDOM(r, 'article', attrs={'id': 'post-\d+'})
            posts = client.parseDOM(posts, 'h1')
            posts = zip(
                client.parseDOM(posts, 'a', ret='href'),
                (client.parseDOM(posts, 'a', attrs={'rel': 'bookmark'})))

            for item in posts:

                try:
                    name = item[1]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d+E\d+|S\d+|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name, re.I)

                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()

                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d+E\d+|S\d+)[\.|\)|\]|\s]',
                        name, re.I)[-1].upper()

                    if not y == hdlr: raise Exception()

                    r = client.request(item[0], referer=self.base_link)
                    r = client.parseDOM(r, 'article', attrs={'id': 'post-\d+'})
                    #links = re.findall('>Single Links</b>(.+?)<p><b><span', data, re.DOTALL)
                    links = [
                        i for i in client.parseDOM(r, 'p')
                        if 'Single Links' in i
                    ]
                    links = zip(
                        client.parseDOM(links, 'a', ret='href'),
                        client.parseDOM(links, 'a', attrs={'href': '.+?'}))

                    for item in links:
                        try:
                            quality, info = source_utils.get_release_quality(
                                item[1], item[0])
                            try:
                                size = re.findall(
                                    '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))',
                                    r[0], re.DOTALL)[0].strip()
                                div = 1 if size.endswith(
                                    ('GB', 'GiB')) else 1024
                                size = float(re.sub('[^0-9|/.|/,]', '',
                                                    size)) / div
                                size = '%.2f GB' % size
                                info.append(size)
                            except:
                                pass

                            info = ' | '.join(info)

                            if any(x in item[0]
                                   for x in ['.rar', '.zip', '.iso']):
                                raise Exception()
                            url = client.replaceHTMLCodes(item[0])
                            url = url.encode('utf-8')

                            hostDict = hostDict + hostprDict

                            valid, host = source_utils.is_host_valid(
                                url, hostDict)
                            if not valid: continue
                            sources.append({
                                'source': host,
                                'quality': quality,
                                'language': 'en',
                                'url': url,
                                'info': info,
                                'direct': False,
                                'debridonly': True
                            })
                        except:
                            pass

                except:
                    pass

            return sources
        except:
            return sources
コード例 #26
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url == None: return sources
         if debrid.status() == False: raise Exception()
         hostDict = hostprDict + hostDict
         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']
         hdlr = '%sS%02dE%02d' % (
             data['year'], int(data['season']), int(data['episode'])
         ) if 'tvshowtitle' in data else data['year']
         query = '%s %s S%02dE%02d' % (
             data['tvshowtitle'], data['year'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                 data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
         try:
             url = self.search_link % urllib.quote_plus(query)
             url = urlparse.urljoin(self.base_link, url)
             r = self.scraper.get(url).content
             posts = client.parseDOM(r, 'div', attrs={'class': 'post'})
             items = []
             dupes = []
             for post in posts:
                 try:
                     t = client.parseDOM(post, 'a')[0]
                     t = re.sub('<.+?>|</.+?>', '', t)
                     x = re.sub(
                         '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                         '', t)
                     if not cleantitle.get(title) in cleantitle.get(x):
                         raise Exception()
                     y = re.findall(
                         '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                         t)[-1].upper()
                     if not y == hdlr: raise Exception()
                     fmt = re.sub(
                         '(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)',
                         '', t.upper())
                     fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                     fmt = [i.lower() for i in fmt]
                     #if not any(i in ['1080p', '720p'] for i in fmt): raise Exception()
                     if len(dupes) > 2: raise Exception()
                     dupes += [x]
                     u = client.parseDOM(post, 'a', ret='href')[0]
                     r = self.scraper.get(u).content
                     u = client.parseDOM(r, 'a', ret='href')
                     u = [(i.strip('/').split('/')[-1], i) for i in u]
                     items += u
                 except:
                     pass
         except:
             pass
         for item in items:
             try:
                 name = item[0]
                 name = client.replaceHTMLCodes(name)
                 t = re.sub(
                     '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                     '', name)
                 if not cleantitle.get(t) == cleantitle.get(title):
                     raise Exception()
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr: raise Exception()
                 quality, info = source_utils.get_release_quality(
                     name, item[1])
                 url = item[1]
                 if any(x in url for x in ['.rar', '.zip', '.iso']):
                     raise Exception()
                 url = client.replaceHTMLCodes(url)
                 url = url.encode('utf-8')
                 host = re.findall(
                     '([\w]+[.][\w]+)$',
                     urlparse.urlparse(url.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': quality,
                     'language': 'en',
                     'url': url,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except:
                 pass
         return sources
     except:
         return
コード例 #27
0
ファイル: dltube.py プロジェクト: vanhung1710/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url == None: return sources
            if debrid.status() == False: raise Exception()

            r = client.request(url)
            mov_id = re.compile('id=movie value=(.+?)/>',
                                re.DOTALL).findall(r)[0]
            mov_id = mov_id.rstrip()
            headers = {
                'Origin':
                'https://mydownloadtube.to',
                'Referer':
                url,
                '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'
            }
            request_url = 'https://mydownloadtube.to/movies/play_online'
            form_data = {'movie': mov_id}
            links_page = client.request(request_url,
                                        headers=headers,
                                        post=form_data)
            matches = re.compile("sources:(.+?)controlbar",
                                 re.DOTALL).findall(links_page)
            match = re.compile("file:window.atob.+?'(.+?)'.+?label:\"(.+?)\"",
                               re.DOTALL).findall(str(matches))
            for link, res in match:
                vid_url = base64.b64decode(link).replace(' ', '%20')
                res = res.replace('3Dp', '3D').replace(' HD', '')
                sources.append({
                    'source': 'DirectLink',
                    'quality': res,
                    'language': 'en',
                    'url': vid_url,
                    'info': '',
                    'direct': True,
                    'debridonly': False
                })

            match2 = re.compile(
                '<[iI][fF][rR][aA][mM][eE].+?[sS][rR][cC]="(.+?)"',
                re.DOTALL).findall(links_page)
            for link in match2:
                host = link.split('//')[1].replace('www.', '')
                host = host.split('/')[0].split('.')[0].title()
                if '1080' in link:
                    res = '1080p'
                elif '720' in link:
                    res = '720p'
                else:
                    res = 'SD',
                if 'flashx' not in link:
                    sources.append({
                        'source': host,
                        'quality': res,
                        'language': 'en',
                        'url': link,
                        'info': 'AC3',
                        'direct': False,
                        'debridonly': False
                    })

            return sources
        except:
            return sources
コード例 #28
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None: return sources

            if debrid.status() is False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)

            posts = client.parseDOM(r, 'item')

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    t = client.parseDOM(post, 'title')[0]
                    u = client.parseDOM(post, 'link')[0]
                    s = re.findall(
                        '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', t)
                    s = s[0] if s else '0'

                    items += [(t, u, s)]

                except:
                    pass

            urls = []
            for item in items:

                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name)

                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()

                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                        name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    quality, info = source_utils.get_release_quality(
                        name, item[1])
                    if any(x in quality for x in ['CAM', 'SD']): continue

                    try:
                        size = re.sub('i', '', item[2])
                        div = 1 if size.endswith('GB') else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    info = ' | '.join(info)

                    url = item[1]
                    links = self.links(url)
                    urls += [(i, quality, info) for i in links]

                except:
                    pass

            for item in urls:

                if 'earn-money' in item[0]: continue
                if any(x in item[0] for x in ['.rar', '.zip', '.iso']):
                    continue
                url = client.replaceHTMLCodes(item[0])
                url = url.encode('utf-8')

                valid, host = source_utils.is_host_valid(url, hostDict)
                if not valid: continue
                host = client.replaceHTMLCodes(host)
                host = host.encode('utf-8')

                sources.append({
                    'source': host,
                    'quality': item[1],
                    'language': 'en',
                    'url': url,
                    'info': item[2],
                    'direct': False,
                    'debridonly': True
                })

            return sources
        except:
            return sources
コード例 #29
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            hostDict = hostprDict + hostDict

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            imdb = data['imdb']

            content = 'episode' if 'tvshowtitle' in data else 'movie'

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)


            try:
                #if feed == True: raise Exception()

                url = self.search_link_2 % urllib.quote_plus(query)
                url = urlparse.urljoin(self.base_link, url)
                myheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0',
                   'Host': 'scenedown.in',
                   'Connection': 'keep-alive',
                   'Accept-Encoding': 'gzip, deflate, sdch'
                }
                r = client.request(url, headers=myheaders)

                posts = client.parseDOM(r, 'div', attrs={'class': 'post'})

                items = [] ; dupes = []

                for post in posts:
                    try:
                        t = client.parseDOM(post, 'a')[0]

                        if content == 'movie':
                            x = re.findall('/(tt\d+)', post)[0]
                            if not x == imdb: raise Exception()
                            q = re.findall('<strong>\s*Video\s*:\s*</strong>.+?\s(\d+)', post)[0]
                            if not int(q) == 1280: raise Exception()
                            if len(dupes) > 3: raise Exception()
                            dupes += [x]

                        elif content == 'episode':
                            x = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', t)
                            if not cleantitle.get(title) in cleantitle.get(x): raise Exception()
                            y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', t)[-1].upper()
                            if not y == hdlr: raise Exception()
                            if len(dupes) > 0: raise Exception()
                            dupes += [x]

                        u = client.parseDOM(post, 'a', ret='href')[0]
                        myheaders['Referer'] = url
                        r = client.request(u, headers=myheaders).replace('\n', '')

                        u = client.parseDOM(r, 'div', attrs={'class': 'postContent'})[0]
                        u = re.split('id\s*=\s*"more-\d+"', u)[-1]

                        if content == 'episode':
                            u = re.compile('(?:<strong>|)(.+?)</strong>(.+?)(?:<strong>|$)', re.MULTILINE|re.DOTALL).findall(u)
                            u = [(re.sub('<.+?>|</.+?>|>', '', i[0]), i[1]) for i in u]
                            u = [i for i in u if '720p' in i[0].lower()][0]
                            u, r, t = u[1], u[1], u[0]

                        u = client.parseDOM(u, 'p')
                        u = [client.parseDOM(i, 'a', ret='href') for i in u]
                        u = [i[0] for i in u if len(i) == 1]
                        if not u: raise Exception()

                        s = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', r)
                        s = s[0] if s else '0'

                        items += [(t, i, s) for i in u]
                    except:
                        pass
            except:
                pass


            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name)

                    if not cleantitle.get(t) == cleantitle.get(title): raise Exception()

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                    fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                    fmt = [i.lower() for i in fmt]

                    if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                    if any(i in ['extras'] for i in fmt): raise Exception()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'HD'
                    else: quality = 'SD'
                    if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt): quality = 'SCR'
                    elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts'] for i in fmt): quality = 'CAM'

                    info = []

                    if '3d' in fmt: info.append('3D')

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    if any(i in ['hevc', 'h265', 'x265'] for i in fmt): info.append('HEVC')

                    info = ' | '.join(info)

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.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': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True})
                except:
                    pass

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #30
0
ファイル: ddls.py プロジェクト: IMthEGREAT1/felipe.repository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            title = data['tvshowtitle']
            season = '%01d' % int(data['season'])
            episode = '%02d' % int(data['episode'])

            r = cache.get(self.ddlseries_tvcache, 120)

            r = [(i[0], i[3]) for i in r
                 if cleantitle.get(title) == cleantitle.get(i[1])
                 and season == i[2]]

            links = []

            for url, quality in r:
                try:
                    link = client.request(url)
                    vidlinks = client.parseDOM(link,
                                               'span',
                                               attrs={'class': 'overtr'})[0]
                    match = re.compile('href="([^"]+)[^>]*>\s*Episode\s+(\d+)<'
                                       ).findall(vidlinks)
                    match = [(i[0], quality) for i in match if episode == i[1]]
                    links += match
                except:
                    pass

            for url, quality in links:
                try:
                    if "protect-links" in url:
                        redirect = client.request(url)
                        url = re.findall('<a href="(.*?)" target="_blank">',
                                         redirect)
                        url = url[0]

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostprDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

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

            return sources
        except:
            return sources
コード例 #31
0
    def sources(self, url, hostDict, hostprDict):
        try:

            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            hostDict = hostprDict + hostDict

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

            #web_pdb.set_trace()
            posts = []

            query = title
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            query = query.replace("&", "")

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = query + ' ' + hdlr

            referer = self.search_link % urllib.quote_plus(query)
            referer = urlparse.urljoin(self.base_link, referer)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)

            posts = client.parseDOM(r, "item")

            urls = []
            for post in posts:
                try:

                    name = re.search('<title>(.*?)</title>', post)
                    name = name.group(1)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name)

                    if not cleantitle.get(t) in cleantitle.get(title):
                        raise Exception()

                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                        name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    urls = client.parseDOM(post, 'a', ret='href')

                    if '720p' in name: quality = 'SD',
                    elif '1080p' in name: quality = '1080p'
                    else: quality = 'SD',

                    for url in urls:
                        try:

                            host = re.findall(
                                '([\w]+[.][\w]+)$',
                                urlparse.urlparse(
                                    url.strip().lower()).netloc)[0]
                            if not host in hostDict: raise Exception()

                            if any(x in url for x in ['.rar', '.zip', '.iso']):
                                raise Exception()

                            info = []

                            if any(x in url.upper()
                                   for x in ['HEVC', 'X265', 'H265']):
                                info.append('HEVC')

                            info.append('ALLRLS')

                            info = ' | '.join(info)

                            host = client.replaceHTMLCodes(host)
                            host = host.encode('utf-8')

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

                        except:
                            pass

                except:
                    pass

            return sources
        except:
            return sources
コード例 #32
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if not debrid.status(): raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)
            r = client.parseDOM(r, 'h2')
            r = [re.findall('''<a.+?href=["']([^"']+)["']>(.+?)</a>''', i, re.DOTALL) for i in r]

            hostDict = hostprDict + hostDict

            items = []

            for item in r:
                try:
                    t = item[0][1]
                    t = re.sub('(\[.*?\])|(<.+?>)', '', t)
                    t1 = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', t)

                    if not cleantitle.get(t1) == cleantitle.get(title): raise Exception()

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', t)[-1].upper()

                    if not y == hdlr: raise Exception()

                    data = client.request(urlparse.urljoin(self.base_link, item[0][0]))
                    data = dom_parser2.parse_dom(data, 'a', attrs={'target': '_blank'})
                    u = [(t, i.content) for i in data]
                    items += u

                except:
                    pass

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    quality, info = source_utils.get_release_quality(name, item[1])

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', name)[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    info = ' | '.join(info)

                    url = item[1]
                    if not url.startswith('http'):continue
                    if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    valid, host = source_utils.is_host_valid(url, hostDict)
                    if not valid: continue
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

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

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #33
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            try:
                if not 'tvshowtitle' in data: raise Exception()

                links = []

                f = [
                    'S%02dE%02d' % (int(data['season']), int(data['episode']))
                ]
                t = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '',
                           data['tvshowtitle'])
                t = t.replace("&", "")

                q = self.search_link + urllib.quote_plus('%s %s' % (t, f[0]))

                q = urlparse.urljoin(self.base_link, q)
                result = client.request(q)
                result = json.loads(result)

                result = result['results']
            except:
                links = result = []

            for i in result:
                try:
                    if not cleantitle.get(t) == cleantitle.get(i['showName']):
                        raise Exception()

                    y = i['release']
                    y = re.compile('[\.|\(|\[|\s](\d{4}|S\d*E\d*)[\.|\)|\]|\s]'
                                   ).findall(y)[-1]
                    y = y.upper()
                    if not any(x == y for x in f): raise Exception()

                    quality = i['quality']

                    quality = quality.upper()

                    size = i['size']
                    size = float(size) / 1024
                    size = '%.2f GB' % size

                    if any(x in quality for x in ['HEVC', 'X265', 'H265']):
                        info = '%s | HEVC' % size
                    else:
                        info = size

                    if '1080P' in quality: quality = '1080p'
                    elif '720P' in quality: quality = 'HD'
                    else: quality = 'SD'

                    url = i['links']
                    #for x in url.keys(): links.append({'url': url[x], 'quality': quality, 'info': info})

                    links = []

                    for x in url.keys():
                        links.append({'url': url[x], 'quality': quality})

                    for link in links:
                        try:
                            url = link['url']
                            quality2 = link['quality']
                            #url = url[1]
                            #url = link
                            if len(url) > 1: raise Exception()
                            url = url[0].encode('utf-8')

                            host = re.findall(
                                '([\w]+[.][\w]+)$',
                                urlparse.urlparse(
                                    url.strip().lower()).netloc)[0]
                            if not host in hostprDict: raise Exception()
                            host = host.encode('utf-8')

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

                except:
                    pass

            return sources
        except:
            return sources
コード例 #34
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources
            if debrid.status() is False:
                raise Exception()
            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']

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s s%02de%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            try:
                r = client.request(url)
                posts = client.parseDOM(r, 'tr')
                for post in posts:
                    links = re.findall('<a href="(/torrent/.+?)">(.+?)<', post,
                                       re.DOTALL)
                    for link, data in links:
                        link = urlparse.urljoin(self.base_link, link)
                        link = client.request(link)
                        link = re.findall(
                            'a class=".+?" rel=".+?" href="(magnet:.+?)"',
                            link, re.DOTALL)
                        try:
                            size = re.findall(
                                '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                                post)[0]
                            div = 1 if size.endswith('GB') else 1024
                            size = float(
                                re.sub('[^0-9|/.|/,]', '',
                                       size.replace(',', '.'))) / div
                            size = '%.2f GB' % size
                        except BaseException:
                            size = '0'
                        for url in link:
                            if hdlr not in url:
                                continue
                            url = url.split('&tr')[0]
                            quality, info = source_utils.get_release_quality(
                                data)
                            if any(x in url for x in [
                                    'Tamil', 'FRENCH', 'Ita', 'italian',
                                    'TRUEFRENCH', '-lat-', 'Dublado'
                            ]):
                                continue
                            info.append(size)
                            info = ' | '.join(info)
                            sources.append({
                                'source': 'Torrent',
                                'quality': quality,
                                'language': 'en',
                                'url': url,
                                'info': info,
                                'direct': False,
                                'debridonly': True
                            })
            except:
                return
            return sources
        except:
            return sources
コード例 #35
0
    def sources(self, url, hostDict, hostprDict):
        try:
            hostDict = hostDict + hostprDict

            sources = []
            query_bases = []
            options = []

            if url is None:
                return sources

            if not debrid.status():
                return sources

            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'])
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            # tvshowtitle
            if 'tvshowtitle' in data:
                query_bases.append('%s ' %
                                   (data['tvshowtitle'].replace("-", "")))
                if 'year' in data:
                    query_bases.append('%s %s ' %
                                       (data['tvshowtitle'], data['year']))
                options.append('S%02dE%02d' %
                               (int(data['season']), int(data['episode'])))
                options.append('S%02d' % (int(data['season'])))
            else:
                query_bases.append('%s %s ' % (data['title'], data['year']))
                query_bases.append('%s ' % (data['title']))
                query_bases.append('2160p')
                query_bases.append('')

            for option in options:
                for query_base in query_bases:
                    q = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '',
                               query_base + option)
                    q = q.replace("  ", " ").replace(" ", "+")
                    url = self.search_link % q
                    url = self.base_link + url + self.search_options
                    html = self.scraper.get(url)
                    if html.status_code == 200:
                        posts = client.parseDOM(
                            html.content,
                            "div",
                            attrs={"class": "main-news-link"})
                        for post in posts:
                            url = client.parseDOM(post, "a", ret='href')
                            if len(url) > 0:
                                html = self.scraper.get(url[0])
                                if html.status_code == 200:
                                    quotes = client.parseDOM(
                                        html.content,
                                        "div",
                                        attrs={"class": "quote"})
                                    for quote in quotes:
                                        hrefs = client.parseDOM(quote,
                                                                "a",
                                                                ret='href')
                                        if not hrefs:
                                            continue
                                        for href in hrefs:
                                            quality = source_utils.check_sd_url(
                                                href)
                                            href = href.encode('utf-8')
                                            valid, host = source_utils.is_host_valid(
                                                href, hostDict)
                                            if any(x in href for x in
                                                   ['.rar', '.zip', '.iso']):
                                                continue
                                            if not valid:
                                                continue
                                            if hdlr in href.upper(
                                            ) and cleantitle.get(
                                                    title) in cleantitle.get(
                                                        href):
                                                sources.append({
                                                    'source':
                                                    host,
                                                    'quality':
                                                    quality,
                                                    'language':
                                                    'en',
                                                    'url':
                                                    href,
                                                    'direct':
                                                    False,
                                                    'debridonly':
                                                    False
                                                })
                if len(sources) > 0:
                    return sources
            return sources
        except:
            return sources
コード例 #36
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None: return sources

            if debrid.status() is False: raise Exception()

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

            t = data['tvshowtitle']
            season = '%01d' % int(data['season'])
            episode = '%02d' % int(data['episode'])

            query = cleantitle.getsearch(t)
            r = urlparse.urljoin(self.base_link, self.search_link2)
            post = {'query': query}
            r = client.request(r, post=post)
            r = dom_parser2.parse_dom(r, 'a')
            r = [(i.attrs['href'],
                  dom_parser2.parse_dom(i.content,
                                        'span',
                                        attrs={'class': 'searchheading'}))
                 for i in r]
            try:
                url = []
                for i in r:
                    t1 = i[1][0].content
                    t2 = re.sub('[Ss]eason\s*\d+', '', t1)
                    if not str(int(season)) in t1: continue
                    if cleantitle.get(t) == cleantitle.get(
                            t2) and not 'pack' in i[0]:
                        url.append(i[0])
                    if len(url) > 1:
                        url = [(i) for i in url if 'hd' in i][0]
                    else:
                        url = url[0]

            except:
                pass
            if len(url) < 0:
                try:
                    r = urlparse.urljoin(self.base_link, self.search_link)
                    t = '%s season %s' % (t, season)
                    post = 'do=search&subaction=search&story=%s' % urllib.quote_plus(
                        cleantitle.getsearch(t))
                    r = client.request(r, post=post)
                    r = dom_parser2.parse_dom(r, 'h4')
                    r = [
                        dom_parser2.parse_dom(i.content, 'a', req=['href'])
                        for i in r if i
                    ]
                    r = [(i[0].attrs['href'], i[0].content) for i in r if i]
                    r = [(i[0], i[1]) for i in r
                         if t.lower() == i[1].replace(' -', '').lower()]
                    r = [(i[0]) for i in r if not 'pack' in i[0]]
                    url = r[0][0]

                except:
                    pass

            links = []

            r = client.request(url)
            name = re.findall('<b>Release Name :.+?">(.+?)</span>', r,
                              re.DOTALL)[0]
            link = client.parseDOM(r,
                                   'span',
                                   attrs={'class': 'downloads nobr'})
            link = [(re.findall(
                '<a href="(.+?)"\s*target="_blank">[Ee]pisode\s*(\d+)</a>', i,
                re.DOTALL)) for i in link]
            for item in link:
                link = [(i[0], i[1]) for i in item if i[1] == str(episode)]
                links.append(link[0][0])

            quality, info = source_utils.get_release_quality(name, None)

            for url in links:
                try:
                    if "protect" in url:
                        redirect = client.request(url)
                        url = re.findall('<a href="(.*?)" target="_blank">',
                                         redirect)
                        url = url[0]

                    valid, host = source_utils.is_host_valid(url, hostDict)
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass

            return sources
        except:
            return sources
コード例 #37
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            s = client.request(self.base_link)
            s = re.findall('\'(http.+?)\'', s) + re.findall('\"(http.+?)\"', s)
            s = [
                i for i in s if urlparse.urlparse(self.base_link).netloc in i
                and len(i.strip('/').split('/')) > 3
            ]
            s = s[0] if s else urlparse.urljoin(self.base_link, 'posts')
            s = s.strip('/')

            url = s + self.search_link % urllib.quote_plus(query)

            r = client.request(url)

            r = client.parseDOM(r, 'h2', attrs={'class': 'post-title'})
            r = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'a', ret='title'))
            r = [(i[0], i[1],
                  re.sub('(\.|\(|\[|\s)(\d{4}|3D)(\.|\)|\]|\s|)(.+|)', '',
                         i[1]),
                  re.findall('[\.|\(|\[|\s](\d{4}|)([\.|\)|\]|\s|].+)', i[1]))
                 for i in r]
            r = [(i[0], i[1], i[2], i[3][0][0], i[3][0][1]) for i in r if i[3]]
            r = [(i[0], i[1], i[2], i[3], re.split('\.|\(|\)|\[|\]|\s|\-',
                                                   i[4])) for i in r]
            r = [
                i for i in r if cleantitle.get(title) == cleantitle.get(i[2])
                and data['year'] == i[3]
            ]
            r = [
                i for i in r if not any(x in i[4] for x in [
                    'HDCAM', 'CAM', 'DVDR', 'DVDRip', 'DVDSCR', 'HDTS', 'TS',
                    '3D'
                ])
            ]
            r = [i for i in r if '1080p' in i[4]
                 ][:1] + [i for i in r if '720p' in i[4]][:1]

            posts = [(i[1], i[0]) for i in r]

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    t = post[0]

                    u = client.request(post[1])
                    u = re.findall('\'(http.+?)\'', u) + re.findall(
                        '\"(http.+?)\"', u)
                    u = [i for i in u if not '/embed/' in i]
                    u = [i for i in u if not 'youtube' in i]

                    items += [(t, i) for i in u]
                except:
                    pass

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name)

                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()

                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                        name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    fmt = re.sub(
                        '(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)',
                        '', name.upper())
                    fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                    fmt = [i.lower() for i in fmt]

                    if any(
                            i.endswith(('subs', 'sub', 'dubbed', 'dub'))
                            for i in fmt):
                        raise Exception()
                    if any(i in ['extras'] for i in fmt): raise Exception()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'HD'
                    else: quality = 'SD'
                    if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt):
                        quality = 'SCR'
                    elif any(i in [
                            'camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam',
                            'dvdts', 'cam', 'telesync', 'ts'
                    ] for i in fmt):
                        quality = 'CAM'

                    info = []

                    if '3d' in fmt: info.append('3D')

                    try:
                        size = re.findall(
                            '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))',
                            item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    if any(i in ['hevc', 'h265', 'x265'] for i in fmt):
                        info.append('HEVC')

                    info = ' | '.join(info)

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso']):
                        raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.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': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #38
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            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']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']), int(data['episode'])) \
                if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url).replace('-', '+')

            r = client.request(url)
            if r == None and 'tvshowtitle' in data:
                season = re.search('S(.*?)E', hdlr)
                season = season.group(1)
                url = title

                r = client.request(url)

            for loopCount in range(0, 2):
                if loopCount == 1 or (r == None and 'tvshowtitle' in data):

                    r = client.request(url)

                posts = client.parseDOM(
                    r, "div", attrs={"class": "postpage_movie_download"})
                hostDict = hostprDict + hostDict
                items = []
                for post in posts:
                    try:
                        u = client.parseDOM(post, 'a', ret='href')
                        for i in u:
                            try:
                                name = str(i)
                                items.append(name)
                                print items
                            except:
                                pass
                    except:
                        pass

                if len(items) > 0: break

            for item in items:
                try:
                    info = []

                    i = str(item)
                    r = client.request(i)
                    u = client.parseDOM(r,
                                        "div",
                                        attrs={"class": "multilink_lnks"})
                    for t in u:
                        r = client.parseDOM(t, 'a', ret='href')
                        for url in r:
                            if '1080p' in url:
                                quality = '1080p'
                            elif '1080' in url:
                                quality = '1080p'
                            elif '720p' in url:
                                quality = '720p'
                            elif '720' in url:
                                quality = '720p'
                            elif 'HD' in url:
                                quality = '720p'
                            else:
                                quality = 'SD'
                            info = ' | '.join(info)
                            valid, host = source_utils.is_host_valid(
                                url, hostDict)
                            sources.append({
                                'source': host,
                                'quality': quality,
                                'language': 'en',
                                'url': url,
                                'info': info,
                                'direct': False,
                                'debridonly': True
                            })

                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #39
0
    def sources(self, url, hostDict, hostprDict):

        try:
            sources = []
            if url == None: return sources

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

            for i in range(4):
                result = client.request(req, timeout=3)
                if not result == None: break

            dom = dom_parser.parse_dom(result,
                                       'div',
                                       attrs={
                                           'class': 'links',
                                           'id': 'noSubs'
                                       })
            result = dom[0].content
            links = re.compile(
                '<i class="fa fa-youtube link-logo"></i>([^<]+).*?href="([^"]+)"\s+class="watch',
                re.DOTALL).findall(result)
            random.shuffle(links)

            if debrid.status() == True:
                debrid_links = []
                for pair in links:
                    for r in debrid.debrid_resolvers:
                        if r.valid_url('', pair[0].strip()):
                            debrid_links.append(pair)
                links = debrid_links + links

            hostDict = hostDict + hostprDict

            conns = 0
            for pair in links:

                if conns > self.max_conns and len(sources) > self.min_srcs:
                    break

                host = pair[0].strip()
                link = pair[1]

                valid, host = source_utils.is_host_valid(host, hostDict)
                if not valid: continue

                link = urlparse.urljoin(self.base_link, link)
                for i in range(2):
                    result = client.request(link, timeout=3)
                    conns += 1
                    if not result == None: break

                try:
                    link = re.compile('href="([^"]+)"\s+class="action-btn'
                                      ).findall(result)[0]
                except:
                    continue

                try:
                    u_q, host, direct = source_utils.check_directstreams(
                        link, host)
                except:
                    continue

                link, quality = u_q[0]['url'], u_q[0]['quality']

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

            return sources
        except:
            failure = traceback.format_exc()
            log_utils.log('WATCHSERIES - Exception: \n' + str(failure))
            return sources
コード例 #40
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            query = re.sub('(\\\|/|-|:|;|\*|\?|"|\'|<|>|\|)', ' ', data['title'])
            query = self.search_link % urllib.quote_plus(query)
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)

            result = client.parseDOM(result, 'div', attrs = {'class': 'item'})

            result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'span', attrs = {'class': 'calidad2'}), client.parseDOM(i, 'span', attrs = {'class': 'tt'}), client.parseDOM(i, 'span', attrs = {'class': 'year'})) for i in result]
            result = [(i[0][0], i[1][0], i[2][0], i[3][0]) for i in result if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0 and len(i[3]) > 0]
            result = [(i[0], i[1], i[2]) for i in result if i[3] == data['year'] and not i[1] == '3D']
            result = [(i[0], i[1], re.sub('(\.|\(|\[|\s)(1080p|720p|3D|\d{4})(\.|\)|\]|\s|)(.+|)', '', i[2])) for i in result]
            result = [(i[0], i[1]) for i in result if cleantitle.get(data['title']) == cleantitle.get(i[2])]

            r = [(i[0], '1080p') for i in result if i[1] == '1080p'][:1]
            r += [(i[0], 'HD') for i in result if i[1] == '720p'][:1]

            quality = r[0][1]

            url = r[0][0]
            url = client.replaceHTMLCodes(url)

            result = client.source(url)

            try:
                links = client.parseDOM(result, 'div', attrs = {'class': 'enlaces_box'})[0]
                links = client.parseDOM(links, 'a', ret='href')
            except:
                links = client.parseDOM(result, 'div', attrs = {'class': 'txt-block'})[0]
                links = links.split('Download Link')[-1]
                links = client.parseDOM(links, 'strong')
                links = client.parseDOM(links, 'a', ret='href')

            for url in links:
                try:
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostDict + hostprDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({'source': host, 'quality': quality, 'provider': 'HEVCmovies', 'url': url, 'info': 'HEVC', 'direct': False, 'debridonly': True})
                except:
                    pass

            return sources
        except:
            return sources
コード例 #41
0
ファイル: rlsbb.py プロジェクト: hpduong/retropie_configs
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            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']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            query = query.replace("&", "and")
            query = query.replace("  ", " ")
            query = query.replace(" ", "-")

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            url = "http://rlsbb.ru/" + query

            if 'tvshowtitle' not in data: url = url + "-1080p"

            r = client.request(url)

            if r == None and 'tvshowtitle' in data:
                season = re.search('S(.*?)E', hdlr)
                season = season.group(1)
                query = title
                query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)
                query = query + "-S" + season
                query = query.replace("&", "and")
                query = query.replace("  ", " ")
                query = query.replace(" ", "-")
                url = "http://rlsbb.ru/" + query
                r = client.request(url)

            posts = client.parseDOM(r, "div", attrs={"class": "content"})
            hostDict = hostprDict + hostDict
            items = []
            for post in posts:
                try:
                    u = client.parseDOM(post, 'a', ret='href')
                    for i in u:
                        try:
                            name = str(i)
                            if hdlr in name.upper(): items.append(name)
                        except:
                            pass
                except:
                    pass

            seen_urls = set()

            for item in items:
                try:
                    info = []

                    url = str(item)
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if url in seen_urls: continue
                    seen_urls.add(url)

                    host = url.replace("\\", "")
                    host2 = host.strip('"')
                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(host2.strip().lower()).netloc)[0]

                    if not host in hostDict: raise Exception()
                    if any(x in host2 for x in ['.rar', '.zip', '.iso']): continue

                    if '720p' in host2:
                        quality = 'HD'
                    elif '1080p' in host2:
                        quality = '1080p'
                    else:
                        quality = 'SD'

                    info = ' | '.join(info)
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')
                    sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': host2, 'info': info, 'direct': False, 'debridonly': True})
                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check
            return sources
        except:
            failure = traceback.format_exc()
            log_utils.log('RLSBB - Exception: \n' + str(failure))
            return sources
コード例 #42
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url == None:
             return sources
         if debrid.status() is False:
             raise Exception()
         if debrid.tor_enabled() is False:
             raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         query = '%s %s' % (data['title'], data['year'])
         url = self.search_link % urllib.quote(query)
         url = urlparse.urljoin(self.base_link, url)
         html = client.request(url)
         try:
             results = client.parseDOM(html, 'div', attrs={'class':
                                                           'row'})[2]
         except:
             return sources
         items = re.findall(
             'class="browse-movie-bottom">(.+?)</div>\s</div>', results,
             re.DOTALL)
         if items is None:
             return sources
         for entry in items:
             try:
                 try:
                     link, name = re.findall(
                         '<a href="(.+?)" class="browse-movie-title">(.+?)</a>',
                         entry, re.DOTALL)[0]
                     name = client.replaceHTMLCodes(name)
                     if not cleantitle.get(name) == cleantitle.get(
                             data['title']):
                         continue
                 except:
                     continue
                 y = entry[-4:]
                 if not y == data['year']:
                     continue
                 response = client.request(link)
                 try:
                     entries = client.parseDOM(
                         response, 'div', attrs={'class': 'modal-torrent'})
                     for torrent in entries:
                         link, name = re.findall(
                             'href="magnet:(.+?)" class="magnet-download download-torrent magnet" title="(.+?)"',
                             torrent, re.DOTALL)[0]
                         link = 'magnet:%s' % link
                         link = str(
                             client.replaceHTMLCodes(link).split('&tr')[0])
                         if link in str(sources):
                             continue
                         quality, info = source_utils.get_release_quality(
                             name, name)
                         try:
                             size = re.findall(
                                 '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                                 torrent)[-1]
                             div = 1 if size.endswith(
                                 ('GB', 'GiB')) else 1024
                             size = float(re.sub('[^0-9|/.|/,]', '',
                                                 size)) / div
                             size = '%.2f GB' % size
                             info.append(size)
                         except:
                             pass
                         info = ' | '.join(info)
                         sources.append({
                             'source': 'Torrent',
                             'quality': quality,
                             'language': 'en',
                             'url': link,
                             'info': info,
                             'direct': False,
                             'debridonly': True
                         })
                 except:
                     continue
             except:
                 continue
         return sources
     except:
         return sources
コード例 #43
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            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']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']
            premDate = ''

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            query = query.replace("&", "and")
            query = query.replace("  ", " ")
            query = query.replace(" ", "-")

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            url = "http://rlsbb.ru/" + query  # this overwrites a bunch of previous lines!
            if 'tvshowtitle' not in data:
                url = url + "-1080p"  # NB: I don't think this works anymore! 2b-checked.

            r = client.request(url)  # curl as DOM object

            if r == None and 'tvshowtitle' in data:
                season = re.search('S(.*?)E', hdlr)
                season = season.group(1)
                query = title
                query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)
                query = query + "-S" + season
                query = query.replace("&", "and")
                query = query.replace("  ", " ")
                query = query.replace(" ", "-")
                url = "http://rlsbb.ru/" + query
                r = client.request(url)

            # looks like some shows have had episodes from the current season released in s00e00 format before switching to YYYY-MM-DD
            # this causes the second fallback search above for just s00 to return results and stops it from searching by date (ex. http://rlsbb.ru/vice-news-tonight-s02)
            # so loop here if no items found on first pass and force date search second time around
            for loopCount in range(0, 2):
                if loopCount == 1 or (
                        r == None and 'tvshowtitle' in data
                ):  # s00e00 serial failed: try again with YYYY-MM-DD
                    # http://rlsbb.ru/the-daily-show-2018-07-24                                 ... example landing urls
                    # http://rlsbb.ru/stephen-colbert-2018-07-24                                ... case and "date dots" get fixed by rlsbb
                    #query= re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)','',data['tvshowtitle'])   # this RE copied from above is just trash

                    premDate = re.sub(
                        '[ \.]', '-', data['premiered']
                    )  # date looks usually YYYY-MM-DD but dunno if always
                    query = re.sub('[\\\\:;*?"<>|/\-\']', '',
                                   data['tvshowtitle']
                                   )  # quadruple backslash = one backslash :p
                    query = query.replace("&", " and ").replace(
                        "  ", " ").replace(
                            " ",
                            "-")  # throw in extra spaces around & just in case
                    query = query + "-" + premDate

                    url = "http://rlsbb.ru/" + query
                    url = url.replace('The-Late-Show-with-Stephen-Colbert',
                                      'Stephen-Colbert')  #
                    #url = url.replace('Some-Specific-Show-Title-No2','Scene-Title2')           # shows I want...
                    #url = url.replace('Some-Specific-Show-Title-No3','Scene-Title3')           #         ...but theTVDB title != Scene release

                    r = client.request(url)

                posts = client.parseDOM(r, "div", attrs={
                    "class": "content"
                })  # get all <div class=content>...</div>
                hostDict = hostprDict + hostDict  # ?
                items = []
                for post in posts:
                    try:
                        u = client.parseDOM(
                            post, 'a',
                            ret='href')  # get all <a href=..... </a>
                        for i in u:  # foreach href url
                            try:
                                name = str(i)
                                if hdlr in name.upper(): items.append(name)
                                elif len(premDate
                                         ) > 0 and premDate in name.replace(
                                             ".", "-"):
                                    items.append(
                                        name
                                    )  # s00e00 serial failed: try again with YYYY-MM-DD
                                # NOTE: the vast majority of rlsbb urls are just hashes! Future careful link grabbing would yield 2x or 3x results
                            except:
                                pass
                    except:
                        pass

                if len(items) > 0: break

            seen_urls = set()

            for item in items:
                try:
                    info = []

                    url = str(item)
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if url in seen_urls: continue
                    seen_urls.add(url)

                    host = url.replace("\\", "")
                    host2 = host.strip('"')
                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(host2.strip().lower()).netloc)[0]

                    if not host in hostDict: raise Exception()
                    if any(x in host2 for x in ['.rar', '.zip', '.iso']):
                        continue

                    if '720p' in host2:
                        quality = 'HD'
                    elif '1080p' in host2:
                        quality = '1080p'
                    else:
                        quality = 'SD'

                    info = ' | '.join(info)
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': host2,
                        'info': info,
                        'direct': False,
                        'debridonly': True
                    })
                    # why is this hardcoded to debridonly=True? seems like overkill but maybe there's a resource-management reason?
                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check
            return sources
        except:
            failure = traceback.format_exc()
            log_utils.log('RLSBB - Exception: \n' + str(failure))
            return sources
コード例 #44
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()


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


            posts = []

            if 'tvshowtitle' in data:
                query = '%s S%02d' % (data['tvshowtitle'], int(data['season']))
                query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

                referer = self.search_link2 % urllib.quote_plus(query)
                referer = urlparse.urljoin(self.search_base_link, referer)

                url = self.search_link % urllib.quote_plus(query)
                url = urlparse.urljoin(self.search_base_link, url)

                result = client.request(url, headers=self.search_header_link, referer=referer)
                try: posts += json.loads(re.findall('({.+?})$', result)[0])['results']
                except: pass

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            referer = self.search_link2 % urllib.quote_plus(query)
            referer = urlparse.urljoin(self.search_base_link, referer)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.search_base_link, url)

            result = client.request(url, headers=self.search_header_link, referer=referer)
            try: posts += json.loads(re.findall('({.+?})$', result)[0])['results']
            except: pass


            links = [] ; dupes = []

            for post in posts:
                try:
                    name = post['post_title'] ; url = post['post_name']

                    if url in dupes: raise Exception()
                    dupes.append(url)

                    t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name)

                    if not cleantitle.get(title) in cleantitle.get(t): raise Exception()

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', name)[-1].upper()

                    if y.isdigit(): cat = 'movie'
                    elif 'S' in y and 'E' in y: cat = 'episode'
                    elif 'S' in y: cat = 'tvshow'

                    if cat == 'movie': hdlr = data['year']
                    elif cat == 'episode': hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode']))
                    elif cat == 'tvshow': hdlr = 'S%02d' % int(data['season'])

                    if not y == hdlr: raise Exception()


                    items = []

                    content = post['post_content']

                    try: items += zip([i for i in client.parseDOM(content, 'p') if 'Release Name:' in i], [i for i in client.parseDOM(content, 'p') if '<strong>Download' in i])
                    except: pass

                    try: items += client.parseDOM(content, 'p', attrs = {'style': '.+?'})
                    except: pass

                    for item in items:
                        try:
                            if type(item) == tuple: item = '######URL######'.join(item)

                            fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                            fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                            fmt = [i.lower() for i in fmt]

                            if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                            if any(i in ['extras'] for i in fmt): raise Exception()

                            if '1080p' in fmt: quality = '1080p'
                            elif '720p' in fmt: quality = 'HD'
                            else: quality = 'SD'
                            if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt): quality = 'SCR'
                            elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts'] for i in fmt): quality = 'CAM'

                            info = []

                            if '3d' in fmt: info.append('3D')

                            try:
                                if cat == 'tvshow': raise Exception()
                                size = re.findall('(\d+(?:\.|/,|)\d+(?:\s+|)(?:GB|GiB|MB|MiB))', item)[0].strip()
                                div = 1 if size.endswith(('GB', 'GiB')) else 1024
                                size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                                size = '%.2f GB' % size
                                info.append(size)
                            except:
                                pass

                            info = ' | '.join(info)

                            url = item.rsplit('######URL######')[-1]
                            url = zip(client.parseDOM(url, 'a'), client.parseDOM(url, 'a', ret='href'))

                            for i in url: links.append({'url': i[1], 'quality': quality, 'info': info, 'host': i[0], 'cat': cat})
                        except:
                            pass

                except:
                    pass


            check = [i for i in links if not i['quality'] == 'CAM']
            if len(check) > 0: links = check

            hostDict = hostprDict + hostDict

            for i in links:
                try:
                    url = i['url']
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if i['cat'] == 'tvshow':
                        if not i['quality'] in ['1080p', 'HD']: raise Exception()
                        if not any(i['host'].lower() in x for x in hostDict): raise Exception()
                        url = client.request(url)
                        url = client.parseDOM(url, 'ol')[0]
                        url = client.parseDOM(url, 'div', attrs = {'style': '.+?'})[int(data['episode'])-1]

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.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': i['quality'], 'provider': 'releaseBB', 'url': url, 'info': i['info'], 'direct': False, 'debridonly': True})
                except:
                    pass

            return sources
        except:
            return sources
コード例 #45
0
ファイル: allrls.py プロジェクト: CYBERxNUKE/xbmc-addon
 def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
     if debrid.status() == False: raise Exception()
     return tvshowtitle
コード例 #46
0
 def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
     if debrid.status() == False: raise Exception()
     return tvshowtitle
コード例 #47
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url == None:
             return sources
         if debrid.status() is False:
             raise Exception()
         if debrid.tor_enabled() is False:
             raise Exception()
         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']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(
             data['episode'])) if 'tvshowtitle' in data else data['year']
         query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) \
             if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|<|>|\|)', ' ', query)
         url = self.search_link % urllib.quote_plus(query)
         url = urlparse.urljoin(self.base_link, url)
         html = client.request(url)
         html = html.replace('&nbsp;', ' ')
         try:
             results = client.parseDOM(html,
                                       'table',
                                       attrs={'id': 'searchResult'})[0]
         except:
             return sources
         rows = re.findall('<tr(.+?)</tr>', results, re.DOTALL)
         if rows is None:
             return sources
         for entry in rows:
             try:
                 try:
                     name = re.findall(
                         'class="detLink" title=".+?">(.+?)</a>', entry,
                         re.DOTALL)[0]
                     name = client.replaceHTMLCodes(name)
                     #t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name, flags=re.I)
                     if not cleantitle.get(title) in cleantitle.get(name):
                         continue
                 except:
                     continue
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr:
                     continue
                 try:
                     seeders = int(
                         re.findall('<td align="right">(.+?)</td>', entry,
                                    re.DOTALL)[0])
                 except:
                     continue
                 if self.min_seeders > seeders:
                     continue
                 try:
                     link = 'magnet:%s' % (re.findall(
                         'a href="magnet:(.+?)"', entry, re.DOTALL)[0])
                     link = str(
                         client.replaceHTMLCodes(link).split('&tr')[0])
                     if link in str(sources):
                         continue
                 except:
                     continue
                 quality, info = source_utils.get_release_quality(
                     name, name)
                 try:
                     size = re.findall(
                         '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                         entry)[-1]
                     div = 1 if size.endswith(('GB', 'GiB')) else 1024
                     size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                     size = '%.2f GB' % size
                     info.append(size)
                 except:
                     pass
                 info = ' | '.join(info)
                 sources.append({
                     'source': 'Torrent',
                     'quality': quality,
                     'language': 'en',
                     'url': link,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except:
                 continue
         check = [i for i in sources if not i['quality'] == 'CAM']
         if check:
             sources = check
         return sources
     except:
         return sources
コード例 #48
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None: return sources

            if debrid.status() is False: raise Exception()

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

            title = data['title'].replace(':','').lower()
            year = data['year']

            query = '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

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

            post = 'do=search&subaction=search&search_start=0&full_search=0&result_from=1&story=%s' % urllib.quote_plus(query)

            r = client.request(url, post=post)
            r = client.parseDOM(r, 'div', attrs={'class': 'box-out margin'})
            r = [(dom_parser2.parse_dom(i, 'div', attrs={'class':'news-title'})) for i in r if data['imdb'] in i]
            r = [(dom_parser2.parse_dom(i[0], 'a', req='href')) for i in r if i]
            r = [(i[0].attrs['href'], i[0].content) for i in r if i]

            hostDict = hostprDict + hostDict

            for item in r:
                try:
                    name = item[0]
                    s = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', name)
                    s = s[0] if s else '0'
                    data = client.request(item[0])
                    data = dom_parser2.parse_dom(data, 'div', attrs={'id': 'r-content'})
                    data = re.findall('\s*<b><a href="(.+?)".+?</a></b>', data[0].content, re.DOTALL)
                    for url in data:
                        try:
                            qual = client.request(url)
                            quals = re.findall('span class="file-title" id="file-title">(.+?)</span', qual)
                            for quals in quals:
                                if '4K' in quals:
                                    quality = '4K'
                                elif '2160p' in quals:
                                    quality = '4K'
                                elif '1080p' in quals:
                                    quality = '1080p'
                                elif '720p' in quals:
                                    quality = '720p'
                                elif any(i in ['dvdscr', 'r5', 'r6'] for i in quals):
                                    quality = 'SCR'
                                elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts']
                                         for i in quals):
                                    quality = 'CAM'
                                else: quality = '720p'

                            info = []
                            if '3D' in name or '.3D.' in quals: info.append('3D'); quality = '1080p'
                            if any(i in ['hevc', 'h265', 'x265'] for i in quals): info.append('HEVC')

                            info = ' | '.join(info)

                            url = client.replaceHTMLCodes(url)
                            url = url.encode('utf-8')
                            if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception()
                            if not 'turbobit' in url: continue
                            sources.append({'source': 'turbobit', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': True, 'debridonly': True})

                        except:
                            pass
                except:
                    pass

            return sources
        except:
            return sources
コード例 #49
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            s = client.request(self.base_link)
            s = re.findall('\'(http.+?)\'', s) + re.findall('\"(http.+?)\"', s)
            s = [i for i in s if urlparse.urlparse(self.base_link).netloc in i and len(i.strip('/').split('/')) > 3]
            s = s[0] if s else urlparse.urljoin(self.base_link, 'posts')
            s = s.strip('/')

            url = s + self.search_link % urllib.quote_plus(query)

            r = client.request(url)

            r = client.parseDOM(r, 'h2', attrs = {'class': 'post-title .+?'})
            l = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'a', ret='title'))
            r = [(i[0], i[1], re.sub('(\.|\(|\[|\s)(\d{4}|3D)(\.|\)|\]|\s|)(.+|)', '', i[1]), re.findall('[\.|\(|\[|\s](\d{4}|)([\.|\)|\]|\s|].+)', i[1])) for i in l]
            r = [(i[0], i[1], i[2], i[3][0][0], i[3][0][1]) for i in r if i[3]]
            r = [(i[0], i[1], i[2], i[3], re.split('\.|\(|\)|\[|\]|\s|\-', i[4])) for i in r]
            r = [i for i in r if cleantitle.get(title) == cleantitle.get(i[2]) and data['year'] == i[3]]
            r = [i for i in r if not any(x in i[4] for x in ['HDCAM', 'CAM', 'DVDR', 'DVDRip', 'DVDSCR', 'HDTS', 'TS', '3D'])]
            r = [i for i in r if '1080p' in i[4]][:1] + [i for i in r if '720p' in i[4]][:1]

            if 'tvshowtitle' in data:
                posts = [(i[1], i[0]) for i in l]
            else:
                posts = [(i[1], i[0]) for i in l]
            hostDict = hostprDict + hostDict

            items = []
            for post in posts:
                try:
                    t = post[0]

                    u = client.request(post[1])
                    u = re.findall('"(http.+?)"', u) + re.findall('"(http.+?)"', u)
                    u = [i for i in u if not '/embed/' in i]
                    u = [i for i in u if not 'youtube' in i]

                    items += [(t, i) for i in u]
                except:
                    pass

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name)

                    if not cleantitle.get(t) == cleantitle.get(title): raise Exception()

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                    fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                    fmt = [i.lower() for i in fmt]
                    print fmt

                    if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                    if any(i in ['extras'] for i in fmt): raise Exception()

                    if '1080p' in fmt:
                        quality = '1080p'
                    elif '720p' in fmt:
                        quality = '720p'
                    else:
                        quality = '720p'

                    if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt): quality = 'SCR'
                    elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts'] for i in fmt): quality = 'CAM'

                    info = []

                    if '3d' in fmt: info.append('3D')

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    if any(i in ['hevc', 'h265', 'x265'] for i in fmt): info.append('HEVC')

                    info = ' | '.join(info)

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.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': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True})
                except:
                    pass

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return
コード例 #50
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None:
                return sources

            if debrid.status() is False:
                raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            hostDict = hostprDict + hostDict

            items = []
            urls = []
            posts = []
            links = []

            url = urlparse.urljoin(self.base_link,
                                   self.search_link % data['imdb'])
            r = client.request(url)
            if 'CLcBGAs/s1600/1.jpg' in r:
                url = client.parseDOM(r, 'a', ret='href')[0]
                self.base_link = url = urlparse.urljoin(
                    url, self.search_link % data['imdb'])
                r = client.request(url)
            posts = client.parseDOM(r, 'article')
            if not posts:
                if 'tvshowtitle' in data:
                    url = urlparse.urljoin(
                        self.base_link, self.search_link %
                        (cleantitle.geturl(title).replace('-', '+') + '+' +
                         hdlr))
                    r = client.request(url,
                                       headers={'User-Agent': client.agent()})
                    posts += client.parseDOM(r, 'article')
                    url = urlparse.urljoin(
                        self.base_link, self.search_link %
                        cleantitle.geturl(title).replace('-', '+'))
                    r = client.request(url,
                                       headers={'User-Agent': client.agent()})
                    posts += client.parseDOM(r, 'article')

            if not posts: return sources
            for post in posts:
                try:
                    t = client.parseDOM(post, 'img', ret='title')[0]
                    u = client.parseDOM(post, 'a', ret='href')[0]
                    s = re.search(
                        '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))',
                        post)
                    s = s.groups()[0] if s else '0'
                    items += [(t, u, s, post)]
                except:
                    pass
            items = set(items)
            items = [
                i for i in items
                if cleantitle.get(title) in cleantitle.get(i[0])
            ]

            for item in items:
                name = item[0]
                u = client.request(item[1])
                if 'tvshowtitle' in data:
                    if hdlr.lower() not in name.lower():
                        pattern = '''<p>\s*%s\s*<\/p>(.+?)<\/ul>''' % hdlr.lower(
                        )
                        r = re.search(pattern, u, flags=re.I | re.S)
                        if not r: continue
                        links = client.parseDOM(r.groups()[0], 'a', ret='href')
                    else:
                        links = client.parseDOM(u, 'a', ret='href')
                else:
                    links = client.parseDOM(u, 'a', ret='href')
                for url in links:
                    valid, host = source_utils.is_host_valid(url, hostDict)
                    if not valid: continue
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    info = []
                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = re.findall(
                            '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))',
                            item[2])[0]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    info = ' | '.join(info)
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True
                    })

            return sources
        except:
            return sources
コード例 #51
0
	def sources(self, url, hostDict, hostprDict):
	
		#log_utils.log('\n\n~~~ incoming sources() url')
		#log_utils.log(url)
	
		try:
			sources = []
			if url == None: return sources

			req = urlparse.urljoin(self.base_link, url)
			
			# three attempts to pull up the episode-page, then bail
			for i in range(4):
				result = client.request(req, timeout=3)
				if not result == None: break
				
				
			# get the key div's contents
			# then get all the links along with preceding text hinting at host
			# ep pages sort links by hoster which is bad if the top hosters
			#	are unavailable for debrid OR if they're ONLY avail for debrid
			#	(for non-debrid peeps) so shuffle the list
			dom = dom_parser.parse_dom(result, 'div', attrs={'class':'links', 'id': 'noSubs'})
			result = dom[0].content		
			links = re.compile('<i class="fa fa-youtube link-logo"></i>([^<]+).*?href="([^"]+)"\s+class="watch',re.DOTALL).findall(result)
			random.shuffle(links)
			
			
			# Here we stack the deck for debrid users by copying
			#  all debrid hosts to the top of the list
			# This is ugly but it works. Someone else please make it cleaner?
			if debrid.status() == True:
				debrid_links = []
				for pair in links:
					for r in debrid.debrid_resolvers:
						if r.valid_url('', pair[0].strip()): debrid_links.append(pair)
				links = debrid_links + links


			# master list of hosts ResolveURL and placenta itself can resolve
			# we'll check against this list to not waste connections on unsupported hosts
			hostDict = hostDict + hostprDict
			
			conns = 0 
			for pair in links:
			
				# try to be a little polite, and limit connections 
				#  (unless we're not getting sources)
				if conns > self.max_conns and len(sources) > self.min_srcs: break	 

				
				# the 2 groups from the link search = hoster name, episode page url
				host = pair[0].strip()	  
				link = pair[1]
				
				
				# check for valid hosts and jump to next loop if not valid
				valid, host = source_utils.is_host_valid(host, hostDict)
				#log_utils.log("\n\n** conn #%s: %s (valid:%s) %s" % (conns,host,valid,link)) #######
				if not valid: continue
				
				
				# two attempts per source link, then bail
				# NB: n sources could potentially cost n*range connections!!! 
				link = urlparse.urljoin(self.base_link, link)
				for i in range(2):
					result = client.request(link, timeout=3)
					conns += 1
					if not result == None: break	 
				
				
				# if both attempts failed, using the result will too, so bail to next loop
				try:
					link = re.compile('href="([^"]+)"\s+class="action-btn').findall(result)[0]
				except: 
					continue
					
					
				# I don't think this scraper EVER has direct links, but...
				#  (if nothing else, it sets the quality)
				try:
					u_q, host, direct = source_utils.check_directstreams(link, host)
				except:
					continue
					
				# check_directstreams strangely returns a list instead of a single 2-tuple
				link, quality = u_q[0]['url'], u_q[0]['quality']
				#log_utils.log('	checked host: %s' % host)
				#log_utils.log('	checked direct: %s' % direct)
				#log_utils.log('	quality, link: %s, %s' % (quality,link))
				#log_utils.log('	# of urls: %s' % len(u_q))

				
				sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': link, 'direct': direct, 'debridonly': False})
					
			return sources
		except:
			failure = traceback.format_exc()
			log_utils.log('WATCHSERIES - Exception: \n' + str(failure))
			return sources
コード例 #52
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            query = re.sub('(\\\|/|-|:|;|\*|\?|"|\'|<|>|\|)', ' ',
                           data['title'])
            query = self.search_link % urllib.quote_plus(query)
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)

            result = client.parseDOM(result, 'div', attrs={'class': 'item'})

            result = [(client.parseDOM(i, 'a', ret='href'),
                       client.parseDOM(i, 'span', attrs={'class': 'calidad2'}),
                       client.parseDOM(i, 'span', attrs={'class': 'tt'}),
                       client.parseDOM(i, 'span', attrs={'class': 'year'}))
                      for i in result]
            result = [(i[0][0], i[1][0], i[2][0], i[3][0]) for i in result
                      if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0
                      and len(i[3]) > 0]
            result = [(i[0], i[1], i[2]) for i in result
                      if i[3] == data['year'] and not i[1] == '3D']
            result = [
                (i[0], i[1],
                 re.sub(
                     '(\.|\(|\[|\s)(1080p|720p|3D|\d{4})(\.|\)|\]|\s|)(.+|)',
                     '', i[2])) for i in result
            ]
            result = [(i[0], i[1]) for i in result
                      if cleantitle.get(data['title']) == cleantitle.get(i[2])]

            r = [(i[0], '1080p') for i in result if i[1] == '1080p'][:1]
            r += [(i[0], 'HD') for i in result if i[1] == '720p'][:1]

            quality = r[0][1]

            url = r[0][0]
            url = client.replaceHTMLCodes(url)

            result = client.source(url)

            try:
                links = client.parseDOM(result,
                                        'div',
                                        attrs={'class': 'enlaces_box'})[0]
                links = client.parseDOM(links, 'a', ret='href')
            except:
                links = client.parseDOM(result,
                                        'div',
                                        attrs={'class': 'txt-block'})[0]
                links = links.split('Download Link')[-1]
                links = client.parseDOM(links, 'strong')
                links = client.parseDOM(links, 'a', ret='href')

            for url in links:
                try:
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostDict + hostprDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({
                        'source': host,
                        'quality': quality,
                        'provider': 'HEVCmovies',
                        'url': url,
                        'info': 'HEVC',
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass

            return sources
        except:
            return sources
コード例 #53
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            dt = int(datetime.datetime.now().strftime('%Y%m%d'))
            mt = {'jan':'1', 'feb':'2', 'mar':'3', 'apr':'4', 'may':'5', 'jun':'6', 'jul':'7', 'aug':'8', 'sep':'9', 'oct':'10', 'nov':'11', 'dec':'12'}

            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']
            hdlr = ['S%02dE%02d' % (int(data['season']), int(data['episode']))] if 'tvshowtitle' in data else ['%s' % str(data['year']), '%s' % str(int(data['year'])+1), '%s' % str(int(data['year'])-1)]

            query = data['tvshowtitle'] if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/|:|;|\*|\?|"|\'|<|>|\|)', '', query)
            query = self.search_link % urllib.quote_plus(query)
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)

            result = client.parseDOM(result, 'div', attrs = {'id': 'post-\d+'})
            result = [(client.parseDOM(i, 'a', ret='href', attrs = {'rel': 'nofollow'}), client.parseDOM(i, 'a', ret='title', attrs = {'rel': 'nofollow'}), client.parseDOM(i, 'span', attrs = {'class': 'date'}), client.parseDOM(i, 'a', attrs = {'rel': 'category tag'})) for i in result]
            result = [(i[0][-1], i[1][-1], i[2][-1], i[3]) for i in result if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0 and len(i[3]) > 0]

            result = [(i[0], i[1], i[2], i[3]) for i in result if '1-Click' in i[3]]
            if not 'tvshowtitle' in data: result = [(i[0], i[1], i[2]) for i in result if 'Movies' in i[3] and not any(x in ['BDRip', 'CAM', 'DVDR', 'DVDRip', 'DVDSCR', 'TS'] for x in i[3])]
            else: result = [(i[0], i[1], i[2]) for i in result if 'Tv Shows' in i[3] and not 'Tv-Pack' in i[3]]

            result = [(i[0], i[1], re.compile('(\w+).+?(\d+).+?(\d{4})').findall(i[2])) for i in result]
            result = [(i[0], i[1], '%04d%02d%02d' % (int(i[2][0][2]), int(mt[i[2][0][0][:3].lower()]), int(i[2][0][1]))) for i in result if len(i[2]) > 0]
            result = [(i[0], i[1], (abs(dt - int(i[2])) < control.integer * 10)) for i in result]
            result = [(i[0], i[1]) for i in result if i[2] == True]

            result = [(i[0], re.compile('(^Download |)(.+)').findall(i[1])) for i in result]
            result = [(i[0], i[1][0][-1], i[1][0][-1].upper()) for i in result if len(i[1]) > 0]
            result = [(i[0], i[1], re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|3D)(\.|\)|\]|\s|)(.+|)', '', i[2]), re.compile('[\.|\(|\[|\s](\d{4}|S\d*E\d*)[\.|\)|\]|\s|]').findall(i[2])) for i in result]
            result = [(i[0], i[1], i[2]) for i in result if len(i[3]) > 0 and any(x in i[3][0] for x in hdlr)]
            result = [(i[0], i[1]) for i in result if cleantitle.get(title) == cleantitle.get(i[2])]

            try: result = [[(i[0], '1080p') for i in result if '1080p' in i[1]][0]] + [[(i[0], 'HD') for i in result if '720p' in i[1]][0]]
            except: result = [[(i[0], 'HD') for i in result if '720p' in i[1]][0]]

            links = []

            for i in result:
                try:
                    result = client.replaceHTMLCodes(i[0])
                    result = client.source(result)
                    result = result.replace('\n', '')
                    result = re.sub('\s\s+', ' ', result)
                    result = re.compile("<span class='info2'(.+)").findall(result)[0]
                    result = result.split("<span class='info2'")[-1].split('<span')[0]
                    result = client.parseDOM(result, 'a', ret='href')
                    for url in result: links.append({'url': url, 'quality': i[1]})
                except:
                    pass

            for i in links:
                try:
                    url = i['url']
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostprDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({'source': host, 'quality': i['quality'], 'provider': 'DDLvalley', 'url': url, 'direct': False, 'debridonly': True})
                except:
                    pass

            return sources
        except:
            return sources
コード例 #54
0
ファイル: mvrls.py プロジェクト: southpaw99/houseatreides
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None: return sources
            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            html = client.request(url)
            posts = client.parseDOM(html, 'item')

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    t = re.findall('<title>(.+?)</title>', post, re.IGNORECASE)[0]
                    u = re.findall('<enclosure url="(.+?)"', post, re.IGNORECASE)
                    s = re.search('((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', post)
                    s = s.groups()[0] if s else '0'
                    items += [(t, i, s) for i in u]
                except:
                    pass

            for item in items:
                try:

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso', '.part']): raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    valid, host = source_utils.is_host_valid(url, hostDict)
                    if not valid: raise Exception()

                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    # t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name, flags=re.I)

                    if not cleantitle.get(title) in cleantitle.get(name):
                        continue

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', name)[-1].upper()

                    if not y == hdlr:
                        continue

                    quality, info = source_utils.get_release_quality(name, url)

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    info = ' | '.join(info)

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

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check:
                sources = check

            return sources
        except:
            return sources
コード例 #55
0
ファイル: ddlvalley.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:    
            sources = []
            
            if url == None: return sources
     
            if debrid.status() == False: raise Exception()
 
            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']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']
            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if\
                'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)
            scraper = cfscrape.create_scraper()
            r = scraper.get(url).content

            items = dom_parser2.parse_dom(r, 'h2')
            items = [dom_parser2.parse_dom(i.content, 'a', req=['href','rel','title','data-wpel-link']) for i in items]
            items = [(i[0].content, i[0].attrs['href']) for i in items]

            hostDict = hostprDict + hostDict

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    scraper = cfscrape.create_scraper()
                    r = scraper.get(item[1]).content     
                    links = dom_parser2.parse_dom(r, 'a', req=['href','rel','data-wpel-link','target'])
                    links = [i.attrs['href'] for i in links]
                    for url in links:
                        try:
                            if hdlr in name:
                                fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                                fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                                fmt = [i.lower() for i in fmt]

                                if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                                if any(i in ['extras'] for i in fmt): raise Exception()

                                if '1080p' in fmt: quality = '1080p'
                                elif '720p' in fmt: quality = '720p'
                                else: quality = 'SD',
                                if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt): quality = 'SCR'
                                elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts'] for i in fmt): quality = 'CAM'

                                info = []

                                if '3d' in fmt: info.append('3D')

                                try:
                                    size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', name[2])[-1]
                                    div = 1 if size.endswith(('GB', 'GiB')) else 1024
                                    size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                                    size = '%.2f GB' % size
                                    info.append(size)
                                except:
                                    pass

                                if any(i in ['hevc', 'h265', 'x265'] for i in fmt): info.append('HEVC')

                                info = ' | '.join(info)

                                if not any(x in url for x in ['.rar', '.zip', '.iso']):
                                    url = client.replaceHTMLCodes(url)
                                    url = url.encode('utf-8')

                                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                                    if host in hostDict: 
                                        host = client.replaceHTMLCodes(host)
                                        host = host.encode('utf-8')

                                        sources.append({'source': host, 'quality': 'SD', 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True})
                        except:
                            pass
                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #56
0
    def sources(self, url, hostDict, hostprDict):
        try:
            self._sources = []

            if url is None:
                return self._sources

            if debrid.status() is False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
            data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
            data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            self.s = cfscrape.create_scraper()

            first = self.s.get(self.base_link).text
            r = self.s.get(url).text

            posts = client.parseDOM(r, 'div', attrs={'class': 'item'})

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    tit = client.parseDOM(post, 'img', ret='alt')[0]
                    c = client.parseDOM(post, 'a', ret='href')[0]
                    name = tit
                    name = client.replaceHTMLCodes(name)

                    t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d+E\d+|S\d+|3D)(\.|\)|\]|\s|)(.+|)', '', name, flags=re.I)

                    if not cleantitle.get(t) == cleantitle.get(title): raise Exception()

                    try:
                        y = re.findall('(?:\.|\(|\[|\s*|)(S\d+E\d+|S\d+)(?:\.|\)|\]|\s*|)', name, re.I)[-1].upper()
                    except BaseException:
                        y = re.findall('(?:\.|\(|\[|\s*|)(\d{4})(?:\.|\)|\]|\s*|)', name, re.I)[0].upper()

                    if not y == hdlr: raise Exception()

                    try:
                        s = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', t)[0]
                    except Exception:
                        s = '0'

                    items += [(tit, c, s)]
                except Exception:
                    pass
            threads = []
            for item in items:
                threads.append(workers.Thread(self._get_sources, item, hostDict))
            [i.start() for i in threads]
            [i.join() for i in threads]

            return self._sources
        except Exception:
            return self._sources
コード例 #57
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                raise Exception()

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

            post = {'query': data['imdb']}
            url = urlparse.urljoin(self.base_link, 'engine/ajax/search.php')
            r = client.request(url, post=post)
            urls = client.parseDOM(r, 'a', ret='href')
            urls = [i for i in urls if not data['imdb'] in i]

            hostDict = hostprDict + hostDict
            links = []
            for u in urls:
                try:
                    data = client.request(u)
                    data = re.findall('</iframe>(.+?)QuoteEEnd--><br /><br',
                                      data, re.DOTALL)[0]
                    links += re.findall(
                        '''start--><b>(.+?)</b>.+?<b><a href=['"](.+?)['"]''',
                        data, re.DOTALL)

                except Exception:
                    pass
            links = [(i[0], i[1]) for i in links if not 'vip' in i[0].lower()]
            for name, url in links:
                try:
                    name = re.sub('<.+?>', '', name)
                    if '4K' in name:
                        quality = '4K'

                    elif '1080p' in name:
                        quality = '1080p'
                    elif '720p' in name:
                        quality = '720p'
                    else:
                        quality = 'SD'

                    info = []
                    if '3D' in name or '.3D.' in url:
                        info.append('3D')
                        quality = '1080p'
                    if any(i in ['hevc', 'h265', 'x265'] for i in name):
                        info.append('HEVC')

                    info = ' | '.join(info)

                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')
                    if any(x in url for x in ['.rar', '.zip', '.iso', 'turk']):
                        raise Exception()

                    if 'ftp' in url:
                        host = 'CDN'
                        direct = True
                    else:
                        valid, host = source_utils.is_host_valid(url, hostDict)
                        if not valid: raise Exception()
                        host = host
                        direct = False

                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

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

            return sources
        except Exception:
            return sources
コード例 #58
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)

            posts = client.parseDOM(r, 'item')

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    items += zip(
                        client.parseDOM(post, 'a', attrs={'target': '_blank'}),
                        client.parseDOM(post,
                                        'a',
                                        ret='href',
                                        attrs={'target': '_blank'}))
                except:
                    pass

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name)

                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()

                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                        name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    fmt = re.sub(
                        '(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)',
                        '', name.upper())
                    fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                    fmt = [i.lower() for i in fmt]

                    if any(
                            i.endswith(('subs', 'sub', 'dubbed', 'dub'))
                            for i in fmt):
                        raise Exception()
                    if any(i in ['extras'] for i in fmt): raise Exception()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'HD'
                    else: quality = 'SD'
                    if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt):
                        quality = 'SCR'
                    elif any(i in [
                            'camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam',
                            'dvdts', 'cam', 'telesync', 'ts'
                    ] for i in fmt):
                        quality = 'CAM'

                    info = []

                    if '3d' in fmt: info.append('3D')

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) [M|G]B)',
                                          name)[-1]
                        div = 1 if size.endswith(' GB') else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    if any(i in ['hevc', 'h265', 'x265'] for i in fmt):
                        info.append('HEVC')

                    info = ' | '.join(info)

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso']):
                        raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.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': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass

            return sources
        except:
            return sources
コード例 #59
0
ファイル: sceper.py プロジェクト: vphuc81/MyRepository
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

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

            hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)

            r = client.request(url)

            posts = client.parseDOM(r, 'item')

            hostDict = hostprDict

            items = []

            for post in posts:
                try:
                    t = client.parseDOM(post, 'title')[0]

                    c = client.parseDOM(post, 'content.+?')[0]

                    s = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', c)
                    s = s[0] if s else '0'

                    u = zip(client.parseDOM(c, 'a', ret='href'), client.parseDOM(c, 'a'))
                    u = [(i[0], i[1], re.findall('PT(\d+)$', i[1])) for i in u]
                    u = [(i[0], i[1]) for i in u if not i[2]]

                    if 'tvshowtitle' in data:
                         u = [([x for x in i[0].strip('//').split('/')][-1], i[0]) for i in u]
                    else:
                         u = [(t, i[0], s) for i in u]

                    items += u
                except:
                    pass

            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)

                    t = re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)', '', name)

                    if not cleantitle.get(t) == cleantitle.get(title): raise Exception()

                    y = re.findall('[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]', name)[-1].upper()

                    if not y == hdlr: raise Exception()

                    fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                    fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                    fmt = [i.lower() for i in fmt]

                    if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                    if any(i in ['extras'] for i in fmt): raise Exception()

                    if '1080p' in fmt: quality = '1080p'
                    elif '720p' in fmt: quality = 'SD',
                    else: quality = 'SD',
                    if any(i in ['dvdscr', 'r5', 'r6'] for i in fmt): quality = 'SCR'
                    elif any(i in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'telesync', 'ts'] for i in fmt): quality = 'CAM'

                    info = []

                    if '3d' in fmt: info.append('3D')

                    try:
                        size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size))/div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass

                    if any(i in ['hevc', 'h265', 'x265'] for i in fmt): info.append('HEVC')

                    info = ' | '.join(info)

                    url = item[1]
                    if any(x in url for x in ['.rar', '.zip', '.iso']): raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.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': url, 'info': info, 'direct': False, 'debridonly': True})
                except:
                    pass

            check = [i for i in sources if not i['quality'] == 'CAM']
            if check: sources = check

            return sources
        except:
            return sources
コード例 #60
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            if debrid.status() == False: raise Exception()

            dt = int(datetime.datetime.now().strftime('%Y%m%d'))

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

            title = data['title']
            hdlr = [
                '%s' % str(data['year']),
                '%s' % str(int(data['year']) + 1),
                '%s' % str(int(data['year']) - 1)
            ]

            query = re.sub('(\\\|/|:|;|\*|\?|"|\'|<|>|\|)', '', title)
            query = self.search_link % urllib.quote_plus(query)
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)
            result = client.parseDOM(result, 'ul', attrs={'class': 'posts'})[0]

            result = client.parseDOM(result, 'li')
            result = [(client.parseDOM(i, 'a', ret='href'),
                       client.parseDOM(i, 'a', attrs={'title': '.+?'}),
                       client.parseDOM(i, 'a', attrs={'rel': 'category tag'}))
                      for i in result]
            result = [(i[0][0], i[1][0], i[0][0], i[2]) for i in result
                      if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0]

            result = [(i[0], i[1], i[2]) for i in result if 'MOVIES' in i[3]]

            result = [(i[0], i[1],
                       re.compile('/(\d{4})/(\d+)/(\d+)/').findall(i[2]))
                      for i in result]
            result = [(i[0], i[1], '%04d%02d%02d' %
                       (int(i[2][0][0]), int(i[2][0][1]), int(i[2][0][2])))
                      for i in result if len(i[2]) > 0]
            result = [(i[0], i[1],
                       (abs(dt - int(i[2])) < control.integer * 30))
                      for i in result]
            result = [(i[0], i[1]) for i in result if i[2] == True]

            result = [
                (i[0],
                 re.sub('(\.|\(|\[|\s)(\d{4}|S\d*E\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', i[1]),
                 re.compile('[\.|\(|\[|\s](1080p|720p)[\.|\)|\]|\s|]').findall(
                     i[1]),
                 re.compile(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*)[\.|\)|\]|\s|]').findall(
                         i[1])) for i in result
            ]
            result = [(i[0], i[1], i[2][0], i[3][0]) for i in result
                      if len(i[2]) > 0 and len(i[3]) > 0]
            result = [(i[0], i[2]) for i in result
                      if cleantitle.get(title) == cleantitle.get(i[1]) and any(
                          x in i[3] for x in hdlr)]

            try:
                result = [[
                    (i[0], '1080p') for i in result if i[1] == '1080p'
                ][0]] + [[(i[0], 'HD') for i in result if i[1] == '720p'][0]]
            except:
                result = [[(i[0], 'HD') for i in result if i[1] == '720p'][0]]

            links = []

            for i in result:
                try:
                    result = client.replaceHTMLCodes(i[0])
                    result = client.source(result)
                    result = client.parseDOM(result,
                                             'div',
                                             attrs={'class':
                                                    'post_content'})[0]
                    result = re.sub('\s\s+', ' ', result)

                    try:
                        size = re.compile('Size\s*:\s*(.+? [M|G]B) ').findall(
                            result)[-1]
                        div = 1 if size.endswith(' GB') else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        info = '%.2f GB' % size
                    except:
                        info = ''

                    result = client.parseDOM(result, 'ul')[0]
                    result = client.parseDOM(result, 'a', ret='href')
                    for url in result:
                        links.append({
                            'url': url,
                            'quality': i[1],
                            'info': info
                        })
                except:
                    pass

            for i in links:
                try:
                    url = i['url']
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.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': i['quality'],
                        'provider': 'MVlinks',
                        'url': url,
                        'info': i['info'],
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass

            return sources
        except:
            return sources