Ejemplo n.º 1
0
 def _get_items(self, url):
     try:
         headers = {'User-Agent': client.agent()}
         r = client.request(url, headers=headers)
         posts = client.parseDOM(r, 'table', attrs={'class': 'table2'})[0]
         posts = client.parseDOM(posts, 'tr')
         for post in posts:
             data = dom.parse_dom(post, 'a', req='href')[1]
             link = urlparse.urljoin(self.base_link, data.attrs['href'])
             name = data.content
             t = name.split(self.hdlr)[0]
             if not cleantitle.get(re.sub('(|)', '', t)) == cleantitle.get(self.title): continue
             try:
                 y = re.findall('[\.|\(|\[|\s|\_|\-](S\d+E\d+|S\d+)[\.|\)|\]|\s|\_|\-]', name, re.I)[-1].upper()
             except BaseException:
                 y = re.findall('[\.|\(|\[|\s\_|\-](\d{4})[\.|\)|\]|\s\_|\-]', name, re.I)[-1].upper()
             if not y == self.hdlr: continue
             try:
                 size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0]
                 div = 1 if size.endswith('GB') else 1024
                 size = float(re.sub('[^0-9|/.|/,]', '', size.replace(',', '.'))) / div
                 size = '%.2f GB' % size
             except BaseException:
                 size = '0'
             self.items.append((name, link, size))
         return self.items
     except BaseException:
         return self.items
Ejemplo n.º 2
0
 def _get_items(self, url):
     items = []
     try:
         r = client.request(url, headers=self.headers)
         posts = client.parseDOM(r, 'tr', attrs={'class': 't-row'})
         posts = [i for i in posts if not 'racker:' in i]
         for post in posts:
             data = client.parseDOM(post, 'a', ret='href')
             url = [i for i in data if 'magnet:' in i][0]
             seeders = re.findall(
                 "<td class='ttable_col2' align='center'><font color='green'><b>(.+?)</b></font></td>", post)[0]
             if self.min_seeders > seeders:
                 continue
             name = client.parseDOM(post, 'a', ret='title')[0]
             t = name.split(self.hdlr)[0]
             if not cleantitle.get(re.sub('(|)', '', t)) == cleantitle.get(self.title): continue
             try:
                 y = re.findall('[\.|\(|\[|\s|\_|\-](S\d+E\d+|S\d+)[\.|\)|\]|\s|\_|\-]', name, re.I)[-1].upper()
             except BaseException:
                 y = re.findall('[\.|\(|\[|\s\_|\-](\d{4})[\.|\)|\]|\s\_|\-]', name, re.I)[-1].upper()
             if not y == self.hdlr: continue
             try:
                 size = re.findall('((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GiB|MiB|GB|MB))', post)[0]
                 div = 1 if size.endswith('GB') else 1024
                 size = float(re.sub('[^0-9|/.|/,]', '', size.replace(',', '.'))) / div
                 size = '%.2f GB' % size
             except BaseException:
                 size = '0'
             items.append((name, url, size))
         return items
     except BaseException:
         return items
Ejemplo n.º 3
0
 def _get_items(self, r):
     try:
         size = re.search(r'<size>([\d]+)</size>', r).groups()[0]
         seeders = re.search(r'<seeders>([\d]+)</seeders>', r).groups()[0]
         _hash = re.search(r'<info_hash>([a-zA-Z0-9]+)</info_hash>', r).groups()[0]
         name = re.search(r'<title>(.+?)</title>', r).groups()[0]
         url = 'magnet:?xt=urn:btih:%s&dn=%s' % (_hash.upper(), urllib.quote_plus(name))
         t = name.split(self.hdlr)[0]
         try:
             y = re.findall(r'[\.|\(|\[|\s|\_|\-](S\d+E\d+|S\d+)[\.|\)|\]|\s|\_|\-]', name, re.I)[-1].upper()
         except BaseException:
             y = re.findall(r'[\.|\(|\[|\s\_|\-](\d{4})[\.|\)|\]|\s\_|\-]', name, re.I)[-1].upper()
         try:
             div = 1000 ** 3
             size = float(size) / div
             size = '%.2f GB' % size
         except BaseException:
             size = '0'
         quality, info = source_utils.get_release_quality(name, name)
         info.append(size)
         info = ' | '.join(info)
         if not seeders == '0':
             if cleantitle.get(re.sub('(|)', '', t)) == cleantitle.get(self.title):
                 if y == self.hdlr:
                     self._sources.append({'source': 'torrent', 'quality': quality, 'language': 'en', 'url': url, 'info': info, 'direct': False, 'debridonly': True})
     except BaseException:
         pass