Exemple #1
0
    def search(self, hoster_url, query):
        parsed_url = core.re.findall(r'(https?://)(.*?\.)?(.*?\..*?)/', hoster_url.base + '/')[0]
        protocol = parsed_url[0]
        domain = parsed_url[2]
        title = core.capwords(query)
        result_url = '%s%s/%s' % (protocol, domain, query.replace(' ', '-'))
        response = self._request.get(result_url, allow_redirects=False)
        if response.status_code == 200:
            result_content = self._request.get(result_url).text
        elif response.status_code == 301:
            redirect_url = response.headers['Location']
            title = redirect_url[8:]
            title = core.capwords(title[title.find('/') + 1:].replace('-', ' ').rstrip('/'))
            result_content = self._request.get(redirect_url).text
        elif hoster_url.search != '':
            (title, result_url) = self.search_with_id(hoster_url, query)
            result_content = self._request.get(result_url).text
        else:
            return None

        link_matches = core.re.findall(r"\"(https?:\/\/(www\.)?(.*?)\/.*?)\"", result_content)

        urls = []
        for match in link_matches:
            urls.append(match[0])

        hoster_result = core.HosterResult(title=title, urls=urls)

        return [hoster_result]
Exemple #2
0
    def search(self, hoster_url, query):
        search_path = hoster_url.search % core.quote_plus(query)
        search_url = '%s%s' % (hoster_url.base, search_path)

        response = self._request.get(search_url)
        if response.status_code != 200:
            return None

        results = response.text
        results = core.json.loads(results)

        if results is None or results.get('error', None) or len(
                results['results']) == 0:
            return []

        results = results['results']
        hoster_results = []
        for result in results:
            title = result['release']
            urls = []

            if result.get('links', None) is None or len(result['links']) == 0:
                continue

            for link_key in result['links'].keys():
                for url in result['links'][link_key]:
                    urls.append(url)

            hoster_results.append(core.HosterResult(title=title, urls=urls))

        return hoster_results
Exemple #3
0
    def search(self, hoster_url, query, search_id=None):
        search_path = hoster_url.search % core.quote_plus(query)
        search_url = '%s%s' % (hoster_url.base, search_path)

        
        response = self._request.get(search_url)
        if response.status_code != 200:
            return None

        result_content = response.text
        posts = result_content.split('<div class="post">')[1:]
        results = []

        for post in posts:
            title = core.re.findall(r"href=\"http://scene-rls\.net/.*title=\"Permalink to (.*?)\"", post)[0]
            link_matches = core.re.findall(r"\"(https?:\/\/(www\.)?(.*?)\/.*?)\"", result_content)

            urls = []
            for match in link_matches:
                urls.append(match[0])

            hoster_result = core.HosterResult(title=title, urls=urls)
            results.append(hoster_result)

        return results