Example #1
0
    def search(self, filename, minSize, newsgroup=None):

        if newsgroup:
            nzbClubURLs = [
                urllib.urlencode({
                    'q': '"' + filename + '"',
                    'qg': newsgroup
                }),
                urllib.urlencode({
                    'q': filename,
                    'qg': newsgroup
                })
            ]
        else:
            nzbClubURLs = [
                urllib.urlencode({'q': '"' + filename + '"'}),
                urllib.urlencode({'q': filename})
            ]

        for suffixURL in nzbClubURLs:

            nzbClubURL = "http://www.nzbclub.com/search.aspx?" + suffixURL
            try:
                nzbClubSoup = BeautifulSoup(
                    self.open(nzbClubURL).read().decode('utf-8', 'ignore'),
                    "html5lib")
            except:
                nzbClubSoup = BeautifulSoup(
                    self.open(nzbClubURL).read().decode('latin-1', 'ignore'),
                    "html5lib")
            if nzbClubSoup:
                sizeInMegs = None
                for row in nzbClubSoup.findAll(isResultRow):
                    sizeSpan = row.find(isInfoLabelSpan)
                    sizeMatch = re.search("\[\s+([0-9]+\.[0-9]+)\s+(.)B ]",
                                          sizeSpan.text)
                    if not sizeMatch:
                        continue

                    sizeCount = float(sizeMatch.group(1))
                    sizeUnit = sizeMatch.group(2)

                    if sizeUnit == 'K':
                        sizeInMegs = sizeCount / 1024
                    elif sizeUnit == 'G':
                        sizeInMegs = sizeCount * 1024
                    else:
                        sizeInMegs = sizeCount

                    if minSize and sizeInMegs < minSize:
                        # ignoring result : too small
                        continue

                    downloadNZBImg = row.find("img", alt="Get NZB")
                    if downloadNZBImg:
                        downloadNZBLink = downloadNZBImg.parent
                        return NZBGetURLSearchResult(
                            self,
                            "http://www.nzbclub.com" + downloadNZBLink["href"],
                            sizeInMegs, nzbClubURL)
Example #2
0
    def search(self, filename, minSize, newsgroup=None):
        
        q = filename
        arguments = tryUrlencode({
            'q': q,
            'age': Env.setting('retention', 'nzb'),
            'sort': 'agedesc',
            'minsize': minSize,
            'rating': 1,
            'max': 250,
            'more': 1,
            'complete': 1,
        })
        nzbs = self.getRSSData(self.urls['search'] % arguments)
        nzbid = None
        for nzb in nzbs:

            enclosure = self.getElement(nzb, 'enclosure').attrib
            nzbindex_id = int(self.getTextElement(nzb, "link").split('/')[4])

        
            nzbid = nzbindex_id 
            age = self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, "pubDate")).timetuple())))
            sizeInMegs = tryInt(enclosure['length']) / 1024 / 1024
            downloadUrl = enclosure['url']
            detailURL = enclosure['url'].replace('/download/', '/release/')
            
        if nzbid:
            return NZBGetURLSearchResult(self, downloadUrl, sizeInMegs, detailURL, age, nzbid)
Example #3
0
    def search(self, filename, minSize, newsgroup=None):

        q = filename

        params = tryUrlencode({
            'q': q,
            'qq': newsgroup,
            'ig': 1,
            'rpp': 200,
            'st': 5,
            'sp': 1,
            'ns': 1,
        })

        nzbs = self.getRSSData(self.urls['search'] % params)

        for nzb in nzbs:

            nzbclub_id = tryInt(
                self.getTextElement(
                    nzb, "link").split('/nzb_view/')[1].split('/')[0])
            enclosure = self.getElement(nzb, "enclosure").attrib
            size = enclosure['length']
            date = self.getTextElement(nzb, "pubDate")

            def extra_check(item):
                full_description = self.getCache('nzbclub.%s' % nzbclub_id,
                                                 item['detail_url'],
                                                 cache_timeout=25920000)

                for ignored in [
                        'ARCHIVE inside ARCHIVE', 'Incomplete',
                        'repair impossible'
                ]:
                    if ignored in full_description:
                        log.info(
                            'Wrong: Seems to be passworded or corrupted files: %s',
                            item['name'])
                #        return False

                #return True

            nzbid = nzbclub_id
            #'name': toUnicode(self.getTextElement(nzb, "title")),
            age = self.calculateAge(int(time.mktime(parse(date).timetuple())))
            sizeInMegs = (tryInt(size) / 1024 / 1024)
            downloadUrl = enclosure['url'].replace(' ', '_')
            nzbClubURL = self.getTextElement(nzb, "link")
            #'get_more_info': self.getMoreInfo,
            #'extra_check': extra_check

            return NZBGetURLSearchResult(self, downloadUrl, sizeInMegs,
                                         nzbClubURL, age, nzbid)
Example #4
0
    def search(self, filename, minSize, newsgroup=None):
        
        if not self.agreed:
            self.agree()

        suffixURL = urllib.urlencode({'hidespam' : 1, 'more' : 0, 'max': '25', 'minsize' : minSize, 'q' : filename})
        refererURL = "http://www.nzbindex.nl/search/?" + suffixURL

        nzbIndexSoup = BeautifulSoup( self.open(refererURL), "html5lib" )

        results = nzbIndexSoup.findAll("tr", {"class" : "odd"}) + nzbIndexSoup.findAll("tr", {"class" : "even"})
                             
        for tr in results:
            nzblink = tr.find("a", text="Download")
            return NZBGetURLSearchResult(self, nzblink.get("href"), None, nzblink.get("href"))