def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if not str(url).startswith('http'): data = parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data[ 'title'] if 'season' in data: season = data['season'] if 'episode' in data: episode = data['episode'] year = data['year'] r = client.request(self.base_link, output='extended', timeout='10') cookie = r[4] headers = r[3] result = r[0] headers['Cookie'] = cookie query = urljoin( self.base_link, self.search_link % quote_plus(cleantitle.getsearch(title))) r = client.request(query, headers=headers, XHR=True) r = json.loads(r)['content'] r = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'a')) if 'tvshowtitle' in data: cltitle = cleantitle.get(title + 'season' + season) cltitle2 = cleantitle.get(title + 'season%02d' % int(season)) r = [ i for i in r if cltitle == cleantitle.get(i[1]) or cltitle2 == cleantitle.get(i[1]) ] vurl = '%s%s-episode-%s' % (self.base_link, str( r[0][0]).replace('/info', ''), episode) vurl2 = None else: cltitle = cleantitle.getsearch(title) cltitle2 = cleantitle.getsearch('%s (%s)' % (title, year)) r = [ i for i in r if cltitle2 == cleantitle.getsearch(i[1]) or cltitle == cleantitle.getsearch(i[1]) ] vurl = '%s%s-episode-0' % (self.base_link, str( r[0][0]).replace('/info', '')) vurl2 = '%s%s-episode-1' % (self.base_link, str( r[0][0]).replace('/info', '')) r = client.request(vurl, headers=headers) headers['Referer'] = vurl slinks = client.parseDOM(r, 'div', attrs={'class': 'anime_muti_link'}) slinks = client.parseDOM(slinks, 'li', ret='data-video') if len(slinks) == 0 and vurl2 is not None: r = client.request(vurl2, headers=headers) headers['Referer'] = vurl2 slinks = client.parseDOM( r, 'div', attrs={'class': 'anime_muti_link'}) slinks = client.parseDOM(slinks, 'li', ret='data-video') for slink in slinks: try: if 'vidnode.net' in slink: for source in more_sources.more_vidnode( slink, hostDict): sources.append(source) else: quality = source_utils.check_url(slink) valid, hoster = source_utils.is_host_valid( slink, hostDict) if valid: sources.append({ 'source': hoster, 'quality': quality, 'info': '', 'language': 'en', 'url': slink, 'direct': False, 'debridonly': False }) except: source_utils.scraper_error('GOWATCHSERIES') pass return sources except: source_utils.scraper_error('GOWATCHSERIES') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = client.request(url) if '<tbody' not in r: return sources posts = client.parseDOM(r, 'tbody')[0] posts = client.parseDOM(posts, 'tr') for post in posts: link = re.findall('a href="(magnet:.+?)" title="(.+?)"', post, re.DOTALL) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0] dsize, isize = source_utils._size(size) except: isize = '0' dsize = 0 for url, ref in link: url = url.split('&tr')[0] name = url.split('&dn=')[1] name = urllib.unquote_plus(name).replace(' ', '.') if source_utils.remove_lang(name): continue if name.startswith('www.'): try: name = name.split(' - ')[1].lstrip() except: name = re.sub(r'\www..+? ', '', name) if 'extramovies.wiki' in name.lower(): name = name.split(' - ')[1].lstrip() t = name.split(hdlr)[0].replace( data['year'], '').replace('(', '').replace(')', '').replace( '&', 'and').replace('.US.', '.').replace('.us.', '.') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality( name, url) info.insert(0, isize) info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('SKYTORRENTS') return sources except: source_utils.scraper_error('SKYTORRENTS') return sources
def sources(self, url, hostDict, hostprDict): sources = [] try: if url is None: return sources if debrid.status() is False: return sources 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) log_utils.log('query = %s' % query, log_utils.LOGDEBUG) # query = query.replace("&", "and").replace(" ", " ").replace(" ", "-") # log_utils.log('query = %s' % query, log_utils.LOGDEBUG) query = query.replace("&", "and") query = re.sub('\s', '-', query) log_utils.log('query = %s' % query, log_utils.LOGDEBUG) url = self.search_link % urllib.quote_plus(query) log_utils.log('url = %s' % url, log_utils.LOGDEBUG) url = urlparse.urljoin(self.base_link, url) log_utils.log('url = %s' % url, log_utils.LOGDEBUG) url = "http://rlsbb.ru/" + query log_utils.log('url = %s' % url, log_utils.LOGDEBUG) if 'tvshowtitle' not in data: url = url + "-1080p" log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = self.scraper.get(url).content # log_utils.log('r = %s' % r, log_utils.LOGDEBUG) if r is 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 = self.scraper.get(url).content posts = client.parseDOM(r, "div", attrs={"class": "content"}) items = [] for post in posts: try: u = client.parseDOM(post, 'a', ret='href') for i in u: try: name = str(i) tit = name.rsplit('/', 1)[1] t = tit.split(hdlr)[0].replace( data['year'], '').replace('(', '').replace( ')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr in name.upper(): items.append(name) except: source_utils.scraper_error('RLSBB') pass except: source_utils.scraper_error('RLSBB') 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: continue if any(x in host2 for x in ['.rar', '.zip', '.iso']): continue quality, info = source_utils.get_release_quality(host2) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', name)[0] div = 1 if size.endswith('GB') else 1024 size = float( re.sub('[^0-9|/.|/,]', '', size.replace( ',', '.'))) / div size = '%.2f GB' % size info.append(size) except: pass 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: source_utils.scraper_error('RLSBB') pass return sources except: source_utils.scraper_error('RLSBB') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources hostDict = hostprDict + hostDict data = 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url).replace('-', '+') # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = client.request(url) posts = client.parseDOM(r, "table", attrs={"class": "download"}) if posts == []: return sources for post in posts: items = zip(client.parseDOM(post, 'a', ret='title'), client.parseDOM(post, 'a', ret='href')) for item in items: try: name = item[0].replace(' ', '.') t = name.split(hdlr)[0].replace(data['year'], '').replace('(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue if source_utils.remove_lang(name): continue i = str(item[1]) i = self.base_link + i r = client.request(i) u = client.parseDOM(r, "div", attrs={"class": "dl-links"}) for t in u: r = zip(re.compile("a href=.+? dl\W+'(.+?)'\W+").findall(t), re.findall('>.\((.+?Mb)\)', t)) for link in r: url = link[0] if any(x in url for x in ['.rar', '.zip', '.iso', '.sample.']): continue if url in str(sources): continue quality, info = source_utils.get_release_quality(name, url) try: dsize, isize = source_utils._size(link[1]) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) valid, host = source_utils.is_host_valid(url, hostDict) if not valid: continue host = client.replaceHTMLCodes(host) try: host = host.encode('utf-8') except: pass sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize}) except: source_utils.scraper_error('DDLSPOT') pass return sources except: source_utils.scraper_error('DDLSPOT') return
def sources(self, url, hostDict, hostprDict): sources = [] try: if url is None: return sources if debrid.status() is False: return sources data = 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') aliases = data['aliases'] episode_title = data['title'] if 'tvshowtitle' in data else None hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('[^A-Za-z0-9\s\.-]+', '', query) if 'tvshowtitle' in data: search_link = self.tvsearch.format(self.key, quote_plus(query)) else: search_link = self.msearch.format(self.key, data['imdb']) # log_utils.log('search_link = %s' % search_link, log_utils.LOGDEBUG) time.sleep(2.1) rjson = client.request(search_link, error=True) if not rjson or not 'torrent_results' in str(rjson): return sources files = json.loads(rjson)['torrent_results'] for file in files: url = file["download"] url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] name = file["title"] name = unquote_plus(name) name = source_utils.clean_name(title, name) if source_utils.remove_lang(name, episode_title): continue if not source_utils.check_title(title, aliases, name, hdlr, data['year']): continue # filter for episode multi packs (ex. S01E01-E17 is also returned in query) if episode_title: if not source_utils.filter_single_episodes(hdlr, name): continue try: seeders = int(file["seeders"]) if self.min_seeders > seeders: continue except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, name) try: dsize, isize = source_utils.convert_size(file["size"], to='GB') info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('TORRENTAPI') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = urlparse.urljoin(self.base_link, self.search_link) # url = url % urllib.quote_plus(query) url = url % urllib.quote(query) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = client.request(url) r = client.parseDOM(r, 'h2') # z = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'a', ret='title')) z = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'a')) if 'tvshowtitle' in data: posts = [(i[1], i[0]) for i in z] else: posts = [(i[1], i[0]) for i in z] hostDict = hostprDict + hostDict items = [] for post in posts: try: try: t = post[0].encode('utf-8') except: t = post[0] u = client.request(post[1]) u = re.findall('\'(http.+?)\'', u) + re.findall( '\"(http.+?)\"', u) u = [i for i in u if '/embed/' not in i] u = [i for i in u if 'youtube' not in i] try: s = re.search( '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', post) s = s.groups()[0] if s else '0' except: s = '0' pass items += [(t, i, s) for i in u] except: source_utils.scraper_error('MYVIDEOLINK') pass for item in items: try: url = item[1] url = client.replaceHTMLCodes(url) url = url.encode('utf-8') void = ('.rar', '.zip', '.iso', '.part', '.png', '.jpg', '.bmp', '.gif') if url.endswith(void): continue valid, host = source_utils.is_host_valid(url, hostDict) if not valid: continue host = client.replaceHTMLCodes(host) host = host.encode('utf-8') name = item[0] name = client.replaceHTMLCodes(name) t = name.split(hdlr)[0].replace(data['year'], '').replace( '(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality(name, url) 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 info = ' | '.join(info) sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) except: source_utils.scraper_error('MYVIDEOLINK') pass return sources except: source_utils.scraper_error('MYVIDEOLINK') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) html = client.request(url) posts = client.parseDOM(html, 'item') items = [] for post in posts: try: t = client.parseDOM(post, 'title')[0] u = client.parseDOM(post, 'enclosure', ret='url') #---rss feed does not contain size info-another reason why switching to site search be better 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']): continue 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') name = item[0] name = client.replaceHTMLCodes(name) # some shows like "Power" have year and hdlr in name t = name.split(hdlr)[0].replace(data['year'], '').replace( '(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality(name, url) try: #---rss feed does not contain size info-another reason why switching to site search be better size = re.findall( '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', item[2])[-1] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('MVRLS') pass return sources except: source_utils.scraper_error('MVRLS') return sources
def get_sources(self, link): try: url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', link, re.DOTALL)[0]) url = unquote_plus(url).split('&tr')[0].replace('&', '&').replace( ' ', '.') url = source_utils.strip_non_ascii_and_unprintable(url) if url in str(self.sources): return hash = re.compile('btih:(.*?)&').findall(url)[0] name = url.split('&dn=')[1] name = source_utils.clean_name(self.title, name) if source_utils.remove_lang(name, self.episode_title): return if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year): return # filter for episode multi packs (ex. S01E01-E17 is also returned in query) if self.episode_title: if not source_utils.filter_single_episodes(self.hdlr, name): return try: seeders = int( client.parseDOM(link, 'td', attrs={'class': 'sy'})[0].replace(',', '')) if self.min_seeders > seeders: return except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', link)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: source_utils.scraper_error('EXTRATORRENT') dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('EXTRATORRENT') pass
def sources(self, url, hostDict, hostprDict): scraper = cfscrape.create_scraper() sources = [] try: if url is None: return sources if debrid.status() is False: return sources data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['title'] year = data['year'] query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', title) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = scraper.get(url).content if r == str([]) or r == '': return sources r = json.loads(r) id = '' for i in r: if i['original_title'] == title and i[ 'release_date'] == year: id = i['id'] break if id == '': return sources link = 'http://moviemagnet.co/movies/torrents?id=%s' % id result = scraper.get(link).content if 'magnet' not in result: return sources result = re.sub(r'\n', '', result) links = re.findall( r'<tr>.*?<a title="Download:\s*(.+?)"href="(magnet:.+?)">.*?title="File Size">\s*(.+?)\s*</td>.*?title="Seeds">([0-9]+|[0-9]+,[0-9]+)\s*<', result) for link in links: name = link[0] name = urllib.unquote_plus(name) name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if source_utils.remove_lang(name): continue match = source_utils.check_title(title, name, year, year) if not match: continue url = link[1] url = urllib.unquote_plus(url).decode('utf8').replace( '&', '&').replace(' ', '.') url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] quality, info = source_utils.get_release_quality(name, url) try: size = link[2] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) try: seeders = int(link[3].replace(',', '')) if self.min_seeders > seeders: continue except: seeders = 0 pass sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('MOVIEMAGNET') return sources except: source_utils.scraper_error('MOVIEMAGNET') return sources
def _get_sources(self, url): try: r = client.request(url) posts = client.parseDOM(r, 'tr') for post in posts: link = re.findall( 'a title="Download Torrent Magnet" href="(magnet:.+?)"', post, re.DOTALL) if link == []: continue for url in link: url = url.split('&tr')[0] if any(x in url.lower() for x in [ 'french', 'italian', 'spanish', 'truefrench', 'dublado', 'dubbed' ]): continue name = url.split('&dn=')[1] name = urllib.unquote_plus(name) t = name.split(self.hdlr)[0].replace( self.year, '').replace('(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(self.title): continue if self.hdlr not in url: continue quality, info = source_utils.get_release_quality(name, url) 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', 'GiB')) else 1024 size = float(re.sub('[^0-9|/.|/,]', '', size)) / div size = '%.2f GB' % size info.append(size) except: pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) except: source_utils.scraper_error('BTSCENE') pass
def sources(self, url, hostDict, hostprDict): try: sources = [] self.hostDict = hostDict + hostprDict if url is None: return sources data = 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'] url = urljoin( self.base_link, self.search_link % quote_plus(cleantitle.query(title))) if 'tvshowtitle' in data: html = self.scraper.get(url).content match = re.compile( 'class="post-item.+?href="(.+?)" title="(.+?)"', re.DOTALL).findall(html) for url, item_name in match: if cleantitle.getsearch(title).lower( ) in cleantitle.getsearch(item_name).lower(): season_url = '%02d' % int(data['season']) episode_url = '%02d' % int(data['episode']) sea_epi = 'S%sE%s' % (season_url, episode_url) result = self.scraper.get(url).content regex = re.compile('href="(.+?)"', re.DOTALL).findall(result) for ep_url in regex: if sea_epi in ep_url: quality, info = source_utils.get_release_quality( url, url) sources.append({ 'source': 'CDN', 'quality': quality, 'language': 'en', 'info': info, 'url': ep_url, 'direct': False, 'debridonly': False }) else: html = self.scraper.get(url).content match = re.compile( '<div class="thumbnail".+?href="(.+?)" title="(.+?)"', re.DOTALL).findall(html) for url, item_name in match: if cleantitle.getsearch(title).lower( ) in cleantitle.getsearch(item_name).lower(): quality, info = source_utils.get_release_quality( url, url) result = self.scraper.get(url).content regex = re.compile('href="/download.php.+?link=(.+?)"', re.DOTALL).findall(result) for link in regex: if 'server=' not in link: try: link = base64.b64decode(link) except: source_utils.scraper_error('EXTRAMOVIES') pass valid, host = source_utils.is_host_valid( link, self.hostDict) if valid: sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'info': info, 'url': link, 'direct': False, 'debridonly': False }) return sources except: source_utils.scraper_error('EXTRAMOVIES') return sources
def get_sources(self, url): try: r = client.request(url) if r == str([]) or r == '' or r is None: return r = json.loads(r) results = r['results'] for item in results: try: url = unquote_plus(item['magnet']).replace(' ', '.') url = re.sub( r'(&tr=.+)&dn=', '&dn=', url) # some links on solidtorrents &tr= before &dn= hash = item['infohash'].lower() name = item['title'] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if name.startswith('www'): try: name = re.sub(r'www(.*?)\W{2,10}', '', name) except: name = name.split('-.', 1)[1].lstrip() if source_utils.remove_lang(name): continue match = source_utils.check_title(self.title, name, self.hdlr, self.year) if not match: continue if url in str(self.sources): continue try: seeders = int(item['swarm']['seeders']) if self.min_seeders > seeders: continue except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, url) try: dsize, isize = source_utils.convert_size(item["size"], to='GB') info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('SOLIDTORRENTS') pass except: source_utils.scraper_error('SOLIDTORRENTS') pass
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources 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.title = self.title.replace('&', 'and').replace( 'Special Victims Unit', 'SVU') self.hdlr = 'S%02dE%02d' % ( int(data['season']), int(data['episode']) ) if 'tvshowtitle' in data else data['year'] self.year = data['year'] query = '%s %s' % (self.title, self.hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) if 'tvshowtitle' in data: url = self.tvsearch.format(urllib.quote_plus(query)) else: url = self.moviesearch.format(urllib.quote_plus(query)) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) items = self._get_items(url) for item in items: try: name = item[0] url = item[1] url = url.split('&tr')[0] quality, info = source_utils.get_release_quality(name, url) info.insert(0, item[2]) # if item[2] != '0' info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': item[3] }) except: source_utils.scraper_error('GLODLS') pass return sources except: source_utils.scraper_error('GLODLS') return sources
def _get_sources(self, url): try: r = client.request(url) r = re.sub(r'\n', '', r) r = re.sub(r'\t', '', r) posts = re.compile( '<table class="table2" cellspacing="0">(.*?)</table>').findall( r) posts = client.parseDOM(posts, 'tr') for post in posts: if '<th' in post: continue links = re.compile( '<a href="(.+?)">.*?<td class="tdnormal">((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))</td><td class="tdseed">([0-9]+|[0-9]+,[0-9]+)</td>' ).findall(post) for items in links: link = items[0].split("/") hash = link[1].lower() name = link[2].replace('+MB+', '') name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') name = name.replace('Worldfree4u.Wiki.', '').replace('Bolly4u.pro.', '') if source_utils.remove_lang(name): continue match = source_utils.check_title(self.title, name, self.hdlr, self.year) if not match: continue url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name) try: seeders = int(items[2].replace(',', '')) if self.min_seeders > seeders: continue except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', items[1])[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('TORRENTDOWNLOAD') pass
def _get_sources(self, url): try: r = client.request(url) posts = client.parseDOM(r, 'div', attrs={'class': 'media'}) for post in posts: # file_name = client.parseDOM(post, 'span', attrs={'class': 'file-name'}) # file_name and &dn= differ 25% of the time. May add check try: seeders = int( re.findall( r'Seeders\s+:\s+<strong class="text-success">([0-9]+|[0-9]+,[0-9]+)</strong>', post, re.DOTALL)[0].replace(',', '')) if self.min_seeders > seeders: return except: seeders = 0 pass link = re.findall('<a href="(magnet:.+?)"', post, re.DOTALL) for url in link: url = urllib.unquote_plus(url).replace('&', '&').replace( ' ', '.') url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] name = url.split('&dn=')[1] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if source_utils.remove_lang(name): continue if name.startswith('www'): try: name = re.sub(r'www(.*?)\W{2,10}', '', name) except: name = name.split('-.', 1)[1].lstrip() match = source_utils.check_title(self.title, name, self.hdlr, self.year) if not match: continue quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', post)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('BTDB') pass
def get_sources(self, link): try: url = '%s%s' % (self.base_link, link) result = client.request(url, timeout='5') if result is None: return if 'magnet' not in result: return url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', result, re.DOTALL)[0]) url = unquote_plus(url).split('&tr=')[0].replace('&', '&').replace( ' ', '.') url = source_utils.strip_non_ascii_and_unprintable(url) if url in str(self.sources): return hash = re.compile('btih:(.*?)&').findall(url)[0] name = url.split('&dn=')[1] name = source_utils.clean_name(self.title, name) if source_utils.remove_lang(name, self.episode_title): return if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year): return # filter for episode multi packs (ex. S01E01-E17 is also returned in query) if self.episode_title: if not source_utils.filter_single_episodes(self.hdlr, name): return try: seeders = int( re.findall('<dt>SWARM</dt><dd>.*?>([0-9]+)</b>', result, re.DOTALL)[0].replace(',', '')) if self.min_seeders > seeders: return except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, url) try: size = re.findall('<dt>SIZE</dt><dd>(.*? [a-zA-Z]{2})', result, re.DOTALL)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('TORLOCK') pass
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = client.request(url) posts = client.parseDOM(r, 'h2') urls = [] for item in posts: if not item.startswith('<a href'): continue try: name = client.parseDOM(item, "a")[0] t = name.split(hdlr)[0].replace(data['year'], '').replace( '(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality( name, item[0]) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', item)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass fileType = source_utils.getFileType(name) info.append(fileType) info = ' | '.join(info) if fileType else info[0] item = client.parseDOM(item, 'a', ret='href') url = item links = self.links(url) if links is None: continue urls += [(i, quality, info) for i in links] except: source_utils.scraper_error('300MBFILMS') 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, 'size': dsize }) return sources except: source_utils.scraper_error('300MBFILMS') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) html = client.request(url) html = html.replace(' ', ' ') try: results = client.parseDOM(html, 'table', attrs={'id': 'searchResult'}) except: return sources url2 = url.replace('/1/', '/2/') html2 = client.request(url2) html2 = html2.replace(' ', ' ') try: results += client.parseDOM(html2, 'table', attrs={'id': 'searchResult'}) except: return sources results = ''.join(results) rows = re.findall('<tr(.+?)</tr>', results, re.DOTALL) if rows is None: return sources for entry in rows: try: try: url = 'magnet:%s' % (re.findall( 'a href="magnet:(.+?)"', entry, re.DOTALL)[0]) url = str(client.replaceHTMLCodes(url).split('&tr')[0]) except: continue try: name = re.findall( 'class="detLink" title=".+?">(.+?)</a>', entry, re.DOTALL)[0] name = client.replaceHTMLCodes(name) name = urllib.unquote_plus(name).replace(' ', '.') if source_utils.remove_lang(name): continue t = name.split(hdlr)[0].replace( data['year'], '').replace('(', '').replace(')', '').replace( '&', 'and').replace('.US.', '.').replace('.us.', '.') if cleantitle.get(t) != cleantitle.get(title): continue except: continue if hdlr not in name: continue try: seeders = int( re.findall('<td align="right">(.+?)</td>', entry, re.DOTALL)[0]) except: continue if self.min_seeders > seeders: continue quality, info = source_utils.get_release_quality(name, url) 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.insert(0, size) except: pass info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) except: source_utils.scraper_error('PIRATEBAY') continue return sources except: source_utils.scraper_error('PIRATEBAY') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources data = 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else ('(' + data['year'] + ')') # query = '%s %s' % (title, hdlr) query = title query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) if 'tvshowtitle' in data: url = self.show_link % query.replace(' ', '-') else: url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) # log_utils.log('url = %s' % url, __name__, log_utils.LOGDEBUG) r = client.request(url) if not r: return sources if 'No results were found' in r: return sources r = client.parseDOM(r, 'div', attrs={'class': 'card'}) for i in r: url = re.compile('href="(magnet.+?)\s*?"').findall(i)[0] try: url = unquote_plus(url).decode('utf8').replace( '&', '&').replace(' ', '.') except: url = unquote_plus(url).replace('&', '&').replace(' ', '.') url = url.split('&tr=')[0].replace(' ', '.') hash = re.compile('btih:(.*?)&').findall(url)[0] name = url.split('&dn=')[1] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if source_utils.remove_lang(name): continue match = source_utils.check_title( title, name, hdlr.replace('(', '').replace(')', ''), data['year']) if not match: continue seeders = 0 # seeders not available on topnow quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', i )[-1] # file size is no longer available on topnow's new site dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('TOPNOW') return sources
def sources(self, url, hostDict, hostprDict): scraper = cfscrape.create_scraper() sources = [] try: if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = scraper.get(url).content posts = client.parseDOM(r, 'div', attrs={'class': 'results'})[0] posts = client.parseDOM(posts, 'dl') for post in posts: links = re.findall('<dt><a href=/(.+)</a>', post, re.DOTALL) try: seeders = int( re.findall('<span>([0-9]+|[0-9]+,[0-9]+)</span>', post, re.DOTALL)[0].replace(',', '')) if self.min_seeders > seeders: continue except: seeders = 0 pass for link in links: hash = link.split('>')[0] name = link.split('>')[1] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if name.startswith('www'): try: name = re.sub(r'www(.*?)\W{2,10}', '', name) except: name = name.split('-.', 1)[1].lstrip() if source_utils.remove_lang(name): continue match = source_utils.check_title( title, name, hdlr, data['year']) if not match: continue url = 'magnet:?xt=urn:btih:%s&dn=%s' % (hash, name) quality, info = source_utils.get_release_quality( name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('TORRENTZ') return except: source_utils.scraper_error('TORRENTZ') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote_plus(query) url = urlparse.urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = client.request(url) posts = client.parseDOM(r, 'tr') for post in posts: links = re.findall('<a href="(/torrent/.+?)">(.+?)<', post, 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: size = '0' for link, ref in links: link = urlparse.urljoin(self.base_link, link) link = client.request(link) link = re.findall( 'a class=".+?" rel=".+?" href="(magnet:.+?)"', link, re.DOTALL) for url in link: url = url.split('&tr')[0] if any(x in url.lower() for x in [ 'french', 'italian', 'spanish', 'truefrench', 'dublado', 'dubbed' ]): continue name = url.split('&dn=')[1] name = urllib.unquote_plus( urllib.unquote_plus(name)) if name.startswith('www.'): try: name = name.split(' - ')[1].lstrip() except: name = re.sub(r'\www..+? ', '', name) t = name.split(hdlr)[0].replace( data['year'], '').replace('(', '').replace( ')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality( name, url) info.append(size) info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) return sources except: source_utils.scraper_error('DOUBLR') return sources except: source_utils.scraper_error('DOUBLR') return sources
def _get_sources(self, url): try: r = client.request(url, timeout='5') posts = client.parseDOM(r, 'tbody')[0] posts = client.parseDOM(posts, 'tr') for post in posts: post = re.sub(r'\n', '', post) post = re.sub(r'\t', '', post) links = re.compile( '<a href="(/torrent_details/.+?)"><span>(.+?)</span>.*?<td class="size-row">(.+?)</td><td class="sn">([0-9]+)</td>' ).findall(post) for items in links: link = urljoin(self.base_link, items[0]) name = items[1] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if source_utils.remove_lang(name): continue match = source_utils.check_title(self.title, name, self.hdlr, self.year) if not match: continue try: seeders = int(items[3].replace(',', '')) if self.min_seeders > seeders: continue except: seeders = 0 pass link = client.request(link, timeout='5') magnet = re.compile('(magnet.+?)"').findall(link)[0] url = unquote_plus(magnet).replace('&', '&').replace(' ', '.') url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|Gb|MB|MiB|Mb))', items[2])[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('ISOHUNT2') pass
def sources(self, url, hostDict, hostprDict): try: sources = [] if url == None: return sources data = parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) aliases = eval(data['aliases']) headers = {} title = data['tvshowtitle'] if 'tvshowtitle' in data else data[ 'title'] year = data['year'] if 'tvshowtitle' in data: episode = data['episode'] season = data['season'] url = self._search(title, year, aliases, headers) url = url.replace( 'online-free', 'season-%s-episode-%s-online-free' % (season, episode)) else: episode = None year = data['year'] url = self._search(data['title'], data['year'], aliases, headers) url = url if 'http' in url else urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) result = client.request(url) result = client.parseDOM(result, 'li', attrs={'class': 'link-button'}) links = client.parseDOM(result, 'a', ret='href') i = 0 for l in links: #if i == 15: #break try: l = l.split('=')[1] l = urljoin(self.base_link, self.video_link % l) result = client.request(l, post={}, headers={'Referer': url}) u = result if 'http' in result else 'http:' + result if ' href' in u: u = u.replace('\r', '').replace('\n', '').replace('\t', '') u = 'http:' + re.compile(r" href='(.+?)'").findall( u)[0] if 'google' in u: valid, hoster = source_utils.is_host_valid(u, hostDict) urls, host, direct = source_utils.check_directstreams( u, hoster) for x in urls: sources.append({ 'source': host, 'quality': x['quality'], 'language': 'en', 'url': x['url'], 'direct': direct, 'debridonly': False }) else: valid, hoster = source_utils.is_host_valid(u, hostDict) if not valid: continue try: u.decode('utf-8') sources.append({ 'source': hoster, 'quality': '720p', 'language': 'en', 'url': u, 'direct': False, 'debridonly': False }) i += 1 except: pass except: source_utils.scraper_error('5MOVIES') pass return sources except: source_utils.scraper_error('5MOVIES') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: return sources data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['title'].replace('&', 'and') hdlr = data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % urllib.quote(query) url = urlparse.urljoin(self.base_link, url).replace('%20', '-') # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) html = client.request(url) if html is None: return sources quality_size = client.parseDOM(html, 'p', attrs={'class': 'quality-size'}) tit = client.parseDOM(html, 'title')[0] try: results = client.parseDOM(html, 'div', attrs={'class': 'ava1'}) except: return sources p = 0 for torrent in results: link = re.findall( 'a data-torrent-id=".+?" href="(magnet:.+?)" class=".+?" title="(.+?)"', torrent, re.DOTALL) for url, ref in link: url = str(client.replaceHTMLCodes(url).split('&tr')[0]) name = url.split('&dn=')[1] name = urllib.unquote_plus(name).replace(' ', '.') if source_utils.remove_lang(name): continue t = name.split(hdlr)[0].replace('&', 'and').replace( '.US.', '.').replace('.us.', '.') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in tit: continue quality, info = source_utils.get_release_quality(ref, url) try: size = re.findall( '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', quality_size[p])[-1] div = 1 if size.endswith(('GB', 'GiB')) else 1024 size = float(re.sub('[^0-9|/.|/,]', '', size)) / div size = '%.2f GB' % size info.insert(0, size) except: pass p += 1 info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) return sources except: source_utils.scraper_error('YTSWS') return sources
def sources_packs(self, url, hostDict, hostprDict, search_series=False, total_seasons=None, bypass_filter=False): sources = [] self.bypass_filter = bypass_filter if search_series: # torrentapi does not have showPacks return sources try: if url is None: return sources if debrid.status() is False: return sources data = parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) self.title = data['tvshowtitle'].replace('&', 'and').replace( 'Special Victims Unit', 'SVU') self.aliases = data['aliases'] self.year = data['year'] self.season_x = data['season'] self.season_xx = self.season_x.zfill(2) query = re.sub('[^A-Za-z0-9\s\.-]+', '', self.title) search_link = self.tvsearch.format( self.key, quote_plus(query + ' S%s' % self.season_xx)) # log_utils.log('search_link = %s' % str(search_link), __name__, log_utils.LOGDEBUG) time.sleep(2.1) rjson = client.request(search_link, error=True) if not rjson or not 'torrent_results' in str(rjson): return sources files = json.loads(rjson)['torrent_results'] for file in files: url = file["download"] url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] name = file["title"] name = unquote_plus(name) name = source_utils.clean_name(self.title, name) if source_utils.remove_lang(name): continue if not self.bypass_filter: if not source_utils.filter_season_pack( self.title, self.aliases, self.year, self.season_x, name): continue package = 'season' try: seeders = int(file["seeders"]) if self.min_seeders > seeders: continue except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, name) try: dsize, isize = source_utils.convert_size(file["size"], to='GB') info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize, 'package': package }) return sources except: source_utils.scraper_error('TORRENTAPI') return sources
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) token = client.request(self.token) token = json.loads(token)["token"] if 'tvshowtitle' in data: search_link = self.tvsearch.format(token, urllib.quote_plus(query), 'format=json_extended') else: search_link = self.msearch.format(token, data['imdb'], 'format=json_extended') # log_utils.log('search_link = %s' % search_link, log_utils.LOGDEBUG) time.sleep(2) rjson = client.request(search_link, error=True) if 'No results found' in rjson: return sources files = json.loads(rjson)['torrent_results'] for file in files: url = file["download"] url = url.split('&tr')[0] name = file["title"] name = urllib.unquote_plus(name).replace(' ', '.') if source_utils.remove_lang(name): continue t = name.split(hdlr)[0].replace(data['year'], '').replace( '(', '').replace(')', '').replace('&', 'and').replace( '.US.', '.').replace('.us.', '.') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in name: continue quality, info = source_utils.get_release_quality(name, name) size = source_utils.convert_size(file["size"]) info.insert(0, size) info = ' | '.join(info) sources.append({ 'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True }) return sources except: source_utils.scraper_error('TORRENTAPI') return sources
def sources(self, url, hostDict, hostprDict): scraper = cfscrape.create_scraper() sources = [] try: if url is None: return sources if debrid.status() is False: return sources data = parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['title'] aliases = data['aliases'] episode_title = data['title'] if 'tvshowtitle' in data else None year = data['year'] query = re.sub('[^A-Za-z0-9\s\.-]+', '', title) url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = scraper.get(url).content if not r: return sources if any(value in str(r) for value in ['No movies found', 'something went wrong']): return sources r = json.loads(r) id = '' for i in r: if i['original_title'] == title and i[ 'release_date'] == year: id = i['id'] break if id == '': return sources link = '%s%s%s' % (self.base_link, '/movies/torrents?id=', id) result = scraper.get(link).content if 'magnet' not in result: return sources result = re.sub(r'\n', '', result) links = re.findall( r'<tr>.*?<a title="Download:\s*(.+?)"href="(magnet:.+?)">.*?title="File Size">\s*(.+?)\s*</td>.*?title="Seeds">([0-9]+|[0-9]+,[0-9]+)\s*<', result) for link in links: name = link[0] name = unquote_plus(name) name = source_utils.clean_name(title, name) if source_utils.remove_lang(name, episode_title): continue if not source_utils.check_title(title.replace('&', 'and'), aliases, name, year, year): continue url = link[1] try: url = unquote_plus(url).decode('utf8').replace( '&', '&').replace(' ', '.') except: url = unquote_plus(url).replace('&', '&').replace(' ', '.') url = url.split('&tr')[0] hash = re.compile('btih:(.*?)&').findall(url)[0] quality, info = source_utils.get_release_quality(name, url) try: size = link[2] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) try: seeders = int(link[3].replace(',', '')) if self.min_seeders > seeders: continue except: seeders = 0 pass sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) return sources except: source_utils.scraper_error('MOVIEMAGNET') return sources except: source_utils.scraper_error('MOVIEMAGNET') return sources
def get_sources(self, link): try: url = 'magnet:%s' % (re.findall('a href="magnet:(.+?)"', link, re.DOTALL)[0]) url = urllib.unquote_plus(url).replace('&', '&').replace(' ', '.') url = url.split('&tr')[0] url = url.encode('ascii', errors='ignore').decode('ascii', errors='ignore') hash = re.compile('btih:(.*?)&').findall(url)[0] name = url.split('&dn=')[1] name = re.sub('[^A-Za-z0-9]+', '.', name).lstrip('.') if source_utils.remove_lang(name): return match = source_utils.check_title(self.title, name, self.hdlr, self.year) if not match: return if url in str(self.sources): return try: seeders = int( client.parseDOM(link, 'td', attrs={'class': 'sy'})[0].replace(',', '')) if self.min_seeders > seeders: return except: seeders = 0 pass quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', link)[0] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass info = ' | '.join(info) self.sources.append({ 'source': 'torrent', 'seeders': seeders, 'hash': hash, 'name': name, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('EXTRATORRENT') pass
def sources(self, url, hostDict, hostprDict): try: sources = [] if url is None: return sources if debrid.status() is False: 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'] title = title.replace('&', 'and').replace('Special Victims Unit', 'SVU') hdlr = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s %s' % (title, hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = urlparse.urljoin(self.base_link, self.search_link) url = url % urllib.quote_plus(query) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = client.request(url) if r is None: return sources if 'Nothing Found' in r: return sources r = client.parseDOM(r, 'article') r1 = client.parseDOM(r, 'h2') r2 = client.parseDOM(r, 'div', attrs={'class': 'entry-excerpt'}) if 'tvshowtitle' in data: # fuckers removed file size for episodes posts = zip(client.parseDOM(r1, 'a', ret='href'), client.parseDOM(r1, 'a')) else: posts = zip( client.parseDOM(r1, 'a', ret='href'), client.parseDOM(r1, 'a'), re.findall( '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', r2[0])) hostDict = hostprDict + hostDict items = [] for post in posts: try: base_u = client.request(post[0]) if 'tvshowtitle' in data: regex = '<b>(' + title + '.*)</b>' lists = zip( re.findall(regex, base_u), re.findall('<ul>(.+?)</ul>', base_u, re.DOTALL)) for links in lists: u = re.findall('\'(http.+?)\'', links[1]) + re.findall( '\"(http.+?)\"', links[1]) t = links[0] s = 0 items += [(t, i, s) for i in u] else: u = re.findall('\'(http.+?)\'', base_u) + re.findall( '\"(http.+?)\"', base_u) u = [i for i in u if '/embed/' not in i] u = [i for i in u if 'youtube' not in i] try: t = post[1].encode('utf-8') except: t = post[1] s = post[2] items += [(t, i, s) for i in u] except: source_utils.scraper_error('MYVIDEOLINK') pass for item in items: try: url = item[1] url = client.replaceHTMLCodes(url) url = url.encode('utf-8') if url.endswith(('.rar', '.zip', '.iso', '.part', '.png', '.jpg', '.bmp', '.gif')): continue valid, host = source_utils.is_host_valid(url, hostDict) if not valid: continue host = client.replaceHTMLCodes(host) host = host.encode('utf-8') name = item[0] name = client.replaceHTMLCodes(name).replace(' ', '.') match = source_utils.check_title(title, name, hdlr, data['year']) if not match: continue quality, info = source_utils.get_release_quality(name, url) try: size = re.findall( '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', item[2])[-1] dsize, isize = source_utils._size(size) info.insert(0, isize) except: dsize = 0 pass fileType = source_utils.getFileType(name) info.append(fileType) info = ' | '.join(info) if fileType else info[0] sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True, 'size': dsize }) except: source_utils.scraper_error('MYVIDEOLINK') pass return sources except: source_utils.scraper_error('MYVIDEOLINK') return sources
def sources(self, url, hostDict, hostprDict): sources = [] try: api_key = control.setting('filepursuit.api') if api_key == '': return sources headers = { "x-rapidapi-host": "filepursuit.p.rapidapi.com", "x-rapidapi-key": api_key } if url is None: return sources data = 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.title = self.title.replace('&', 'and').replace( 'Special Victims Unit', 'SVU') self.aliases = data['aliases'] self.hdlr = 'S%02dE%02d' % ( int(data['season']), int(data['episode']) ) if 'tvshowtitle' in data else data['year'] self.year = data['year'] query = '%s %s' % (self.title, self.hdlr) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query) url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) r = client.request(url, headers=headers) r = json.loads(r) if 'not_found' in r['status']: return sources results = r['files_found'] for item in results: try: size = int(item['file_size_bytes']) except: size = 0 try: name = item['file_name'] except: name = item['file_link'].split('/')[-1] if source_utils.remove_lang(name): continue if not source_utils.check_title(self.title, self.aliases, name, self.hdlr, self.year): continue url = item['file_link'] quality, info = source_utils.get_release_quality(name, url) try: dsize, isize = source_utils.convert_size(size, to='GB') if isize: info.insert(0, isize) except: source_utils.scraper_error('FILEPURSUIT') dsize = 0 pass info = ' | '.join(info) sources.append({ 'source': 'direct', 'quality': quality, 'name': name, 'language': "en", 'url': url, 'info': info, 'direct': True, 'debridonly': False, 'size': dsize }) return sources except: source_utils.scraper_error('FILEPURSUIT') return sources