def sources(self, url, hostDict, hostprDict): self._sources = [] try: if url is None: return self._sources if debrid.status() is False: return self._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 = cleantitle.get_query(self.title) self.hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year'] query = '%s S%02dE%02d' % (self.title, int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (self.title, data['year']) query = re.sub(r'(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query) if 'tvshowtitle' in data: url = self.search.format('8', quote(query)) else: url = self.search.format('4', 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
def sources(self, url, hostDict, hostprDict): self.sources = [] try: scraper = cfscrape.create_scraper() if url is None: return self.sources if debrid.status() is False: return self.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.episode_title = data[ 'title'] if 'tvshowtitle' in data else None 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('[^A-Za-z0-9\s\.-]+', '', query) urls = [] url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) urls.append(url) # urls.append('%s%s' % (url, '&page=2')) # next page seems broken right now # urls.append('%s%s' % (url, '&page=3')) # log_utils.log('urls = %s' % urls, log_utils.LOGDEBUG) links = [] for x in urls: r = scraper.get(x).content if not r: continue list = client.parseDOM(r, 'tr', attrs={'class': 'tlr'}) list += client.parseDOM(r, 'tr', attrs={'class': 'tlz'}) for item in list: links.append(item) threads = [] for link in links: threads.append(workers.Thread(self.get_sources, link)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: source_utils.scraper_error('EXTRATORRENT') return self.sources
def sources(self, url, hostDict, hostprDict): try: self._sources = [] if url is None: return self._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%02d' % (int(data['season'])) 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, 'figure') items = [] for post in posts: try: tit = client.parseDOM(post, 'img', ret='title')[0] tit = client.replaceHTMLCodes(tit) t = tit.split(hdlr)[0].replace(data['year'], '').replace('(', '').replace(')', '').replace('&', 'and') if cleantitle.get(t) != cleantitle.get(title): continue if hdlr not in tit: continue url = client.parseDOM(post, 'a', ret='href')[0] items.append((url, tit)) except: pass threads = [] for i in items: threads.append(workers.Thread(self._get_sources, i[0], i[1], hostDict, hostprDict)) [i.start() for i in threads] [i.join() for i in threads] return self._sources except: return self._sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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 = cleantitle.get_query(title) hdlr = data['year'] hdlr2 = 'S%02dE%02d' % (int(data['season']), int( data['episode'])) if 'tvshowtitle' in data else '' imdb = data['imdb'] url = self.search(title, hdlr) headers = {'User-Agent': client.agent()} r = cfScraper.get(url, headers=headers).content r = ensure_text(r, errors='replace') if hdlr2 == '': r = dom_parser2.parse_dom(r, 'ul', {'id': 'releases'})[0] else: r = dom_parser2.parse_dom(r, 'ul', {'id': 'episodes'})[0] r = dom_parser2.parse_dom(r.content, 'a', req=['href']) r = [(i.content, urljoin(self.base_link, i.attrs['href'])) for i in r if i and i.content != 'Watch'] if hdlr2 != '': r = [(i[0], i[1]) for i in r if hdlr2.lower() in i[0].lower()] self.hostDict = hostDict + hostprDict threads = [] for i in r: threads.append(workers.Thread(self._get_sources, i[0], i[1])) [i.start() for i in threads] alive = [x for x in threads if x.is_alive() is True] while alive: alive = [x for x in threads if x.is_alive() is True] time.sleep(0.1) return self.sources except: log_utils.log('RMZ - Exception', 1) return self.sources
def sources_packs(self, url, hostDict, hostprDict, search_series=False, total_seasons=None, bypass_filter=False): self.sources = [] try: self.search_series = search_series self.total_seasons = total_seasons self.bypass_filter = bypass_filter if url is None: return self.sources if debrid.status() is False: return self.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.imdb = data['imdb'] 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) queries = [ self.search_link % quote_plus(query + ' S%s' % self.season_xx), self.search_link % quote_plus(query + ' Season %s' % self.season_x) ] if search_series: queries = [ self.search_link % quote_plus(query + ' Season'), self.search_link % quote_plus(query + ' Complete') ] threads = [] for url in queries: link = urljoin(self.base_link, url) threads.append(workers.Thread(self.get_sources_packs, link)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: source_utils.scraper_error('SKYTORRENTS') return self.sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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.episode_title = data[ 'title'] if 'tvshowtitle' in data else None 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('[^A-Za-z0-9\s\.-]+', '', query) url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) # log_utils.log('url = %s' % url, log_utils.LOGDEBUG) try: r = client.request(url, timeout='5') if r is None: return self.sources links = re.findall('<a href=(/torrent/.+?)>', r, re.DOTALL) threads = [] for link in links: threads.append(workers.Thread(self.get_sources, link)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: source_utils.scraper_error('TORLOCK') return self.sources except: source_utils.scraper_error('TORLOCK') return self.sources
def sources(self, url, hostDict, hostprDict): try: self._sources = [] if url is None: return self._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'] 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 % cleantitle.geturl(query) url = urlparse.urljoin(self.base_link, query) r = client.request(url) posts = dom_parser2.parse_dom(r, 'div', {'class': 'eTitle'}) posts = [ dom_parser2.parse_dom(i.content, 'a', req='href') for i in posts if i ] posts = [(i[0].attrs['href'], re.sub('<.+?>', '', i[0].content)) for i in posts if i] posts = [ (i[0], i[1]) for i in posts if (cleantitle.get_simple(i[1].split(hdlr)[0]) == cleantitle.get(title) and hdlr.lower() in i[1].lower()) ] self.hostDict = hostDict + hostprDict threads = [] for i in posts: threads.append(workers.Thread(self._get_sources, i)) [i.start() for i in threads] [i.join() for i in threads] alive = [x for x in threads if x.is_alive() == True] while alive: alive = [x for x in threads if x.is_alive() == True] time.sleep(0.1) return self._sources except Exception: return self._sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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) 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) links = re.findall('<a href="(/torrent/.+?)"', r, re.DOTALL) threads = [] for link in links: threads.append(workers.Thread(self.get_sources, link)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: return self.sources except: return self.sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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.episode_title = data[ 'title'] if 'tvshowtitle' in data else None 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('[^A-Za-z0-9\s\.-]+', '', query) urls = [] url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url) urls.append(url) # urls.append(url.replace('page=0', 'page=40')) # server response time WAY to slow to parse 2 pages deep, site sucks. # log_utils.log('urls = %s' % urls, log_utils.LOGDEBUG) threads = [] for url in urls: threads.append(workers.Thread(self.get_sources, url)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: source_utils.scraper_error('ISOHUNT2') return self.sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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 = cleantitle.get_query(self.title) self.hdlr = 's%02de%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year'] self.hdlr = self.hdlr.lower() self.year = data['year'] query = '%s %s' % (self.title, self.hdlr) query = re.sub('[^A-Za-z0-9\s\.-]+', '', query) url = self.search_link % quote_plus(query) url = urljoin(self.base_link, url).replace('+', '-') try: r = client.request(url) links = re.findall('<a href="(/torrent/.+?)"', r, re.DOTALL)[:20] threads = [] for link in links: threads.append(workers.Thread(self.get_sources, link)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: log_utils.log('YourBT3 - Exception', 1) return self.sources except: log_utils.log('YourBT3 - Exception', 1) return self.sources
def sources(self, url, hostDict, hostprDict): self.sources = [] try: if url is None: return self.sources if debrid.status() is False: return self.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.episode_title = data['title'] if 'tvshowtitle' in data else None 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('[^A-Za-z0-9\s\.-]+', '', 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) if not r: return self.sources rows = client.parseDOM(r, 'div', attrs={'id': 'profile1'}) threads = [] for row in rows: threads.append(workers.Thread(self.get_sources, row)) [i.start() for i in threads] [i.join() for i in threads] return self.sources except: source_utils.scraper_error('MAGNET4YOU') return self.sources
def sources(self, url, hostDict, hostprDict): try: self._sources = [] self.items = [] if url is None: return self._sources if debrid.status() is False: return 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(query)) url = urlparse.urljoin(self.base_link, url) else: url = self.moviesearch.format(urllib.quote(query)) url = urlparse.urljoin(self.base_link, url) 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
def sources(self, url, hostDict, hostprDict): try: self._sources = [] self.items = [] if url is None: return self._sources if debrid.status() is False: return self._sources self.tvsearch = '%s/sort-category-search/%s/TV/seeders/desc/1/' % ( self.base_link, '%s') self.moviesearch = '%s/sort-category-search/%s/Movies/size/desc/1/' % ( self.base_link, '%s') 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 = cleantitle.get_query(self.title) self.hdlr = 'S%02dE%02d' % ( int(data['season']), int(data['episode']) ) if 'tvshowtitle' in data else data['year'] query = '%s S%02dE%02d' % ( self.title, int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % ( self.title, data['year']) query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query) urls = [] if 'tvshowtitle' in data: urls.append(self.tvsearch % (quote(query))) ''' Why spam for multiple pages, since it gives plenty on each page? urls.append(self.tvsearch.format(quote(query), '2')) urls.append(self.tvsearch.format(quote(query), '3')) ''' else: urls.append(self.moviesearch % (quote(query))) ''' Why spam for multiple pages, since it gives plenty on each page? urls.append(self.moviesearch.format(quote(query), '2')) urls.append(self.moviesearch.format(quote(query), '3')) ''' threads = [] for url in urls: threads.append(workers.Thread(self._get_items, url)) [i.start() for i in threads] [i.join() for i in threads] self.hostDict = hostDict + hostprDict threads2 = [] for i in self.items: threads2.append(workers.Thread(self._get_sources, i)) [i.start() for i in threads2] [i.join() for i in threads2] return self._sources except: log_utils.log('1337x_exc2', 1) return self._sources