|
|
@ -17,7 +17,7 @@ class Base(TorrentMagnetProvider): |
|
|
|
} |
|
|
|
|
|
|
|
def _search(self, movie, quality, results): |
|
|
|
limit = 1 |
|
|
|
limit = 10 |
|
|
|
page = 1 |
|
|
|
data = self.getJsonData(self.urls['search'] % (getTitle(movie), limit, page)) |
|
|
|
|
|
|
@ -25,37 +25,44 @@ class Base(TorrentMagnetProvider): |
|
|
|
movie_count = tryInt(data['data']['movie_count']) |
|
|
|
|
|
|
|
if movie_count == 0: |
|
|
|
log.error('%s returned an error (search or tryInt() failed): %s', (self.getName(), data['error'])) |
|
|
|
log.debug('%s - found no results', (self.getName())) |
|
|
|
else: |
|
|
|
result = data['data']['movies'][0] |
|
|
|
name = result['title'] |
|
|
|
year = result['year'] |
|
|
|
detail_url = result['url'] |
|
|
|
|
|
|
|
|
|
|
|
for torrent in result['torrents']: |
|
|
|
t_quality = torrent['quality'] |
|
|
|
|
|
|
|
if t_quality in quality['label']: |
|
|
|
hash = torrent['hash'] |
|
|
|
size = tryInt(torrent['size_bytes'] / 1048576) |
|
|
|
seeders = tryInt(torrent['seeds']) |
|
|
|
leechers = tryInt(torrent['peers']) |
|
|
|
pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 |
|
|
|
pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') |
|
|
|
age = (datetime.now() - pubdate).days |
|
|
|
|
|
|
|
results.append({ |
|
|
|
'id': random.randint(100, 9999), |
|
|
|
'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), |
|
|
|
'url': self.make_magnet(hash, name), |
|
|
|
'size': size, |
|
|
|
'seeders': seeders, |
|
|
|
'leechers': leechers, |
|
|
|
'age': age, |
|
|
|
'detail_url': detail_url, |
|
|
|
'score': 1 |
|
|
|
}) |
|
|
|
|
|
|
|
movie_results = data['data']['movies'] |
|
|
|
for i in range(0,len(movie_results)): |
|
|
|
result = data['data']['movies'][i] |
|
|
|
name = result['title'] |
|
|
|
|
|
|
|
t = movie['info']['original_title'].split(' ') |
|
|
|
|
|
|
|
if all(word in name for word in t) and movie['info']['year'] == result['year']: |
|
|
|
|
|
|
|
year = result['year'] |
|
|
|
detail_url = result['url'] |
|
|
|
|
|
|
|
for torrent in result['torrents']: |
|
|
|
t_quality = torrent['quality'] |
|
|
|
|
|
|
|
if t_quality in quality['label']: |
|
|
|
hash = torrent['hash'] |
|
|
|
size = tryInt(torrent['size_bytes'] / 1048576) |
|
|
|
seeders = tryInt(torrent['seeds']) |
|
|
|
leechers = tryInt(torrent['peers']) |
|
|
|
pubdate = torrent['date_uploaded'] # format: 2017-02-17 18:40:03 |
|
|
|
pubdate = datetime.strptime(pubdate, '%Y-%m-%d %H:%M:%S') |
|
|
|
age = (datetime.now() - pubdate).days |
|
|
|
|
|
|
|
results.append({ |
|
|
|
'id': random.randint(100, 9999), |
|
|
|
'name': '%s (%s) %s %s %s' % (name, year, 'YTS', t_quality, 'BR-Rip'), |
|
|
|
'url': self.make_magnet(hash, name), |
|
|
|
'size': size, |
|
|
|
'seeders': seeders, |
|
|
|
'leechers': leechers, |
|
|
|
'age': age, |
|
|
|
'detail_url': detail_url, |
|
|
|
'score': 1 |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|