Beispiel #1
0
    def search(imdbid, title, year):
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info('Searching Torrentz2 for {}'.format(title))

        url = u'https://torrentz2.eu/feed?f={}+{}'.format(title, year).replace(
            ' ', '+')

        request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
        try:
            if proxy_enabled and Proxy.whitelist(
                    'https://torrentz2.eu') is True:
                response = Proxy.bypass(request)
            else:
                response = urllib2.urlopen(request)

            response = urllib2.urlopen(request, timeout=60).read()
            if response:
                results = Torrentz2.parse(response, imdbid)
                return results
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e:  # noqa
            logging.error(u'Torrentz2 search.', exc_info=True)
            return []
Beispiel #2
0
    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 []
Beispiel #3
0
    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 []
Beispiel #4
0
    def search_newznab(self, url_base, apikey, **params):
        ''' Searches Newznab for imdbid
        url_base: str base url for all requests (https://indexer.com/)
        apikey: str api key for indexer
        params: parameters to url encode and append to url

        Creates url based off url_base. Appends url-encoded **params to url.

        Returns list of dicts of search results
        '''

        url = u'{}api?apikey={}&{}'.format(url_base, apikey,
                                           urllib.urlencode(params))

        logging.info(u'SEARCHING: {}api?apikey=APIKEY&{}'.format(
            url_base, urllib.urlencode(params)))

        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        request = Url.request(url)

        try:
            if proxy_enabled and Proxy.whitelist(url) is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            return self.parse_newznab_xml(response)
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e:  # noqa
            logging.error(u'Newz/TorzNab backlog search.', exc_info=True)
            return []
Beispiel #5
0
    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)
Beispiel #6
0
    def search_potato(self, imdbid):
        ''' Search all TorrentPotato providers
        imdbid: str imdb id #

        Returns list of dicts with movie info
        '''
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        indexers = core.CONFIG['Indexers']['TorrentPotato'].values()
        results = []

        for indexer in indexers:
            if indexer[2] is False:
                continue
            url = indexer[0]
            if url[-1] == u'/':
                url = url[:-1]
            passkey = indexer[1]

            search_string = u'{}?passkey={}&t=movie&imdbid={}'.format(
                url, passkey, imdbid)

            logging.info(
                u'SEARCHING: {}?passkey=PASSKEY&t=movie&imdbid={}'.format(
                    url, imdbid))

            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)

                torrent_results = json.loads(response.read()).get('results')

                if torrent_results:
                    for i in torrent_results:
                        results.append(i)
                else:
                    continue
            except (SystemExit, KeyboardInterrupt):
                raise
            except Exception, e:  # noqa
                logging.error(u'Torrent search_potato.', exc_info=True)
                continue
Beispiel #7
0
    def _get_rss(self):
        ''' Get latest uploads from all indexers

        Returns list of dicts with parsed nzb info
        '''

        self.imdbid = None

        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        if self.feed_type == 'nzb':
            indexers = core.CONFIG['Indexers']['NewzNab'].values()
        else:
            indexers = core.CONFIG['Indexers']['TorzNab'].values()

        results = []

        for indexer in indexers:
            if indexer[2] is False:
                continue
            url_base = indexer[0]
            if url_base[-1] != u'/':
                url_base = url_base + '/'
            apikey = indexer[1]

            url = u'{}api?t=movie&cat=2000&extended=1&offset=0&apikey={}'.format(
                url_base, apikey)

            logging.info(
                u'RSS_SYNC: {}api?t=movie&cat=2000&extended=1&offset=0&apikey=APIKEY'
                .format(url_base))

            request = Url.request(url)

            try:
                if proxy_enabled and Proxy.whitelist(url) is True:
                    response = Proxy.bypass(request)
                else:
                    response = Url.open(request)

                return self.parse_newznab_xml(response)
            except (SystemExit, KeyboardInterrupt):
                raise
            except Exception, e:  # noqa
                logging.error(u'Newz/TorzNab rss get xml.', exc_info=True)
Beispiel #8
0
    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 []
Beispiel #9
0
    def get_rss():
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Fetching latest RSS from Rarbg.')
        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://www.torrentapi.org/pubapi_v2.php?token={}&mode=list&category=movies&format=json_extended&app_id=Watcher'.format(Rarbg.token)

        request = Url.request(url)

        Rarbg.timeout = datetime.datetime.now() + datetime.timedelta(seconds=2)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.torrentapi.org') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            results = json.loads(response).get('torrent_results')
            if results:
                return Rarbg.parse(results)
            else:
                logging.info(u'Nothing found in Rarbg RSS.')
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'Rarbg RSS fetch failed.', exc_info=True)
            return []
Beispiel #10
0
    def get_rss():
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Fetching latest RSS from ExtraTorrent.')

        url = u'https://www.extratorrent.cc/rss.xml?cid=4&type=today'

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.extratorrent.cc') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return ExtraTorrent.parse(response, None)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'ExtraTorrent RSS fetch failed.', exc_info=True)
            return []
Beispiel #11
0
    def get_rss():
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Fetching latest RSS from ThePirateBay.')

        url = u'https://www.thepiratebay.org/browse/201/0/3/0'

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.thepiratebay.org') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return ThePirateBay.parse(response, None)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'ThePirateBay RSS fetch failed.', exc_info=True)
            return []
Beispiel #12
0
    def get_rss():
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Fetching latest RSS from Torrentz2.')

        url = u'https://www.torrentz2.eu/feed?f=movies'

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.torrentz2.eu') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return Torrentz2.parse(response, None)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'Torrentz2 RSS fetch failed.', exc_info=True)
            return []
Beispiel #13
0
    def search(imdbid, term):
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Searching Torrentz2 for {}.'.format(term))

        url = u'https://www.torrentz2.eu/feed?f={}'.format(term)

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.torrentz2.eu') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return Torrentz2.parse(response, imdbid)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'Torrentz2 search failed.', exc_info=True)
            return []
Beispiel #14
0
    def get_rss():
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Fetching latest RSS from BitSnoop.')

        url = u'https://www.bitsnoop.com/browse/video-movies/?sort=dt_reg&fmt=rss'

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.bitsnoop.com') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return BitSnoop.parse(response, None)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'BitSnoop RSS fetch failed.', exc_info=True)
            return []
Beispiel #15
0
    def search(imdbid, term):
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Searching BitSnoop for {}.'.format(term))

        url = u'https://www.bitsnoop.com/search/video/{}/c/d/1/?fmt=rss'.format(term)

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.bitsnoop.com') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

                if response:
                    return BitSnoop.parse(response, imdbid)
                else:
                    return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'BitSnoop search failed.', exc_info=True)
            return []
Beispiel #16
0
    def search(imdbid, term):
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Searching ExtraTorrent for {}.'.format(term))

        url = u'https://www.extratorrent.cc/rss.xml?type=search&cid=4&search={}'.format(term)

        request = Url.request(url)
        try:
            if proxy_enabled and Proxy.whitelist('https://www.extratorrent.cc') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return ExtraTorrent.parse(response, imdbid)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'ExtraTorrent search failed.', exc_info=True)
            return []
Beispiel #17
0
    def search(imdbid, term):
        proxy_enabled = core.CONFIG['Server']['Proxy']['enabled']

        logging.info(u'Searching ThePirateBay for {}.'.format(term))

        url = u'https://www.thepiratebay.org/search/{}/0/99/200'.format(term)

        request = Url.request(url)
        request.add_header('Cookie', 'lw=s')
        try:
            if proxy_enabled and Proxy.whitelist('https://www.thepiratebay.org') is True:
                response = Proxy.bypass(request)
            else:
                response = Url.open(request)

            if response:
                return ThePirateBay.parse(response, imdbid)
            else:
                return []
        except (SystemExit, KeyboardInterrupt):
            raise
        except Exception, e: # noqa
            logging.error(u'ThePirateBay search failed.', exc_info=True)
            return []