def search(imdbid, title, year): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info(u'Searching BitSnoop for {}'.format(title)) url = u'https://bitsnoop.com/search/video/{}+{}/c/d/1/?fmt=rss'.format( title, year).replace(' ', '+').encode('ascii', 'ignore') request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'}) try: if proxy_enabled and Proxy.whitelist( 'https://bitsnoop.com') is True: response = Proxy.bypass(request) else: response = urllib2.urlopen(request) response = urllib2.urlopen(request, timeout=60).read() if response: results = BitSnoop.parse(response, imdbid) return results else: return [] except (SystemExit, KeyboardInterrupt): raise except Exception, e: # noqa logging.error(u'BitSnoop search.', exc_info=True) return []
def search(imdbid, title, year): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info(u'Searching ExtraTorrent for {}'.format(title)) url = u'https://extratorrent.cc/rss.xml?type=search&cid=4&search={}+{}'.format( title, year).replace(' ', '+').encode('ascii', 'ignore') request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'}) try: if proxy_enabled and Proxy.whitelist( 'https://www.limetorrents.cc') is True: response = Proxy.bypass(request) else: response = urllib2.urlopen(request) response = urllib2.urlopen(request, timeout=60).read() if response: results = ExtraTorrent.parse(response, imdbid) return results else: return [] except (SystemExit, KeyboardInterrupt): raise except Exception, e: # noqa logging.error(u'ExtraTorrent search.', exc_info=True) return []
def search_all(self, imdbid): ''' Search all Newznab indexers. :param imdbid: string imdb movie id. tt123456 Returns list of dicts with sorted nzb information. ''' proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] indexers = core.CONFIG['Indexers']['NewzNab'].values() self.imdbid = imdbid results = [] imdbid_s = imdbid[2:] # just imdbid numbers for indexer in indexers: if indexer[2] is False: continue url = indexer[0] if url[-1] != u'/': url = url + '/' apikey = indexer[1] search_string = u'{}api?apikey={}&t=movie&imdbid={}'.format( url, apikey, imdbid_s) logging.info( u'SEARCHING: {}api?apikey=APIKEY&t=movie&imdbid={}'.format( url, imdbid_s)) request = urllib2.Request(search_string, headers={'User-Agent': 'Mozilla/5.0'}) try: if proxy_enabled and Proxy.whitelist(url) is True: response = Proxy.bypass(request) else: response = urllib2.urlopen(request) results_xml = response.read() nn_results = self.parse_newznab_xml(results_xml) for result in nn_results: results.append(result) except (SystemExit, KeyboardInterrupt): raise except Exception, e: # noqa logging.error(u'NewzNab search_all get xml', exc_info=True)
def search(imdbid): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info(u'Searching Rarbg for {}'.format(imdbid)) if Rarbg.timeout: now = datetime.datetime.now() while Rarbg.timeout > now: time.sleep(1) now = datetime.datetime.now() if not Rarbg.token: Rarbg.token = Rarbg.get_token() if Rarbg.token is None: logging.error(u'Unable to get rarbg token.') return [] url = u'https://torrentapi.org/pubapi_v2.php?token={}&mode=search&search_imdb={}&category=movies&format=json_extended'.format( Rarbg.token, imdbid) request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'}) Rarbg.timeout = datetime.datetime.now() + datetime.timedelta(seconds=2) try: if proxy_enabled and Proxy.whitelist( 'https://torrentapi.org') is True: response = Proxy.bypass(request) else: response = urllib2.urlopen(request) response = urllib2.urlopen(request, timeout=60).read() response = json.loads(response).get('torrent_results') if response: results = Rarbg.parse(response) return results else: logging.info(u'Nothing found on rarbg.to') return [] except (SystemExit, KeyboardInterrupt): raise except Exception, e: # noqa logging.error(u'Rarbg search.', exc_info=True) return []
def search(imdbid): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info('Searching Rarbg for {}.'.format(imdbid)) if Rarbg.timeout: now = datetime.datetime.now() while Rarbg.timeout > now: time.sleep(1) now = datetime.datetime.now() if not Rarbg.token: Rarbg.token = Rarbg.get_token() if Rarbg.token is None: logging.error('Unable to get Rarbg token.') return [] url = 'https://www.torrentapi.org/pubapi_v2.php?token={}&mode=search&search_imdb={}&category=movies&format=json_extended&app_id=Watcher'.format( Rarbg.token, imdbid) Rarbg.timeout = datetime.datetime.now() + datetime.timedelta(seconds=2) try: if proxy_enabled and Proxy.whitelist( 'https://www.torrentapi.org') is True: response = Url.open(url, proxy_bypass=True).text else: response = Url.open(url).text results = json.loads(response).get('torrent_results') if results: return Rarbg.parse(results) else: logging.info('Nothing found on Rarbg.') return [] except (SystemExit, KeyboardInterrupt): raise except Exception as e: # noqa logging.error('Rarbg search failed.', exc_info=True) return []
def search(imdbid, term): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info('Searching SkyTorrents for {}.'.format(term)) url = 'https://www.skytorrents.in/rss/all/ed/1/{}'.format(term) try: if proxy_enabled and Proxy.whitelist( 'https://www.skytorrents.in') is True: response = Url.open(url, proxy_bypass=True).text else: response = Url.open(url).text if response: return SkyTorrents.parse(response, imdbid) else: return [] except (SystemExit, KeyboardInterrupt): raise except Exception as e: # noqa logging.error('SkyTorrents search failed.', exc_info=True) return []
def get_rss(): proxy_enabled = core.CONFIG['Server']['Proxy']['enabled'] logging.info('Fetching latest RSS from LimeTorrents.') url = 'https://www.limetorrents.cc/rss/16/' try: if proxy_enabled and Proxy.whitelist( 'https://www.limetorrents.cc') is True: response = Url.open(url, proxy_bypass=True).text else: response = Url.open(url).text if response: return LimeTorrents.parse(response, None) else: return [] except (SystemExit, KeyboardInterrupt): raise except Exception as e: # noqa logging.error('LimeTorrent RSS fetch failed.', exc_info=True) return []