def _real_extract(self, query):
    mobj = re.match(self._make_valid_url(), query)
    if (mobj is None):
        raise ExtractorError(('Invalid search query "%s"' % query))
    prefix = mobj.group('prefix')
    query = mobj.group('query')
    if (prefix == ''):
        return self._get_n_results(query, 1)
    elif (prefix == 'all'):
        return self._get_n_results(query, self._MAX_RESULTS)
    else:
        n = int(prefix)
        if (n <= 0):
            raise ExtractorError(('invalid download number %s for query "%s"' % (n, query)))
        elif (n > self._MAX_RESULTS):
            self._downloader.report_warning(('%s returns max %i results (you requested %i)' % (self._SEARCH_KEY, self._MAX_RESULTS, n)))
            n = self._MAX_RESULTS
        return self._get_n_results(query, n)
def _real_extract(self, query):
    mobj = re.match(self._make_valid_url(), query)
    if (mobj is None):
        raise ExtractorError(('Invalid search query "%s"' % query))
    prefix = mobj.group('prefix')
    query = mobj.group('query')
    if (prefix == ):
        return self._get_n_results(query, 1)
    elif (prefix == 'all'):
        return self._get_n_results(query, self._MAX_RESULTS)
    else:
        n = int(prefix)
        if (n <= 0):
            raise ExtractorError(('invalid download number %s for query "%s"' % (n, query)))
        elif (n > self._MAX_RESULTS):
            self._downloader.report_warning(('%s returns max %i results (you requested %i)' % (self._SEARCH_KEY, self._MAX_RESULTS, n)))
            n = self._MAX_RESULTS
        return self._get_n_results(query, n)