Skip to content

Commit

Permalink
changed download from magnet to torrent
Browse files Browse the repository at this point in the history
fixes #15
  • Loading branch information
neothematrix committed Apr 25, 2017
1 parent 01bd5c8 commit c54f92d
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from couchpotato.core.helpers.encoding import simplifyString, tryUrlencode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.base import TorrentMagnetProvider
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
from couchpotato.core.media.movie.providers.base import MovieProvider
import datetime
import traceback
Expand All @@ -11,7 +11,7 @@
log = CPLog(__name__)


class CorsaroNero(TorrentMagnetProvider, MovieProvider):
class CorsaroNero(TorrentProvider, MovieProvider):

urls = {
'test': 'http://ilcorsaronero.info',
Expand All @@ -21,7 +21,7 @@ class CorsaroNero(TorrentMagnetProvider, MovieProvider):
}

cat_ids = [
(1, ['dvdrip', '3d', '720p', '1080p', 'bd50', 'brrip']),
(1, ['dvdrip', '3d', '720p', '1080p', 'bd50', 'brrip', '2160p']),
(19, ['scr', 'r5', 'cam', 'ts', 'tc']),
(20, ['dvdr'])
]
Expand Down Expand Up @@ -69,13 +69,6 @@ def ageToDays(self, age_str):
# to int
return tdelta.days

# retrieves the magnet link from the detail page of the original torrent result
def getMagnetLink(self, url):
data = self.getHTMLData(url)
html = BeautifulSoup(data)
magnet = html.find('a', attrs={'class': 'forbtn'})['href']
return magnet

# filters the <td> elements containing the results, if any
def parseResults(self, results, entries, movie, title):
table_order = ['Cat', 'Name', 'Size', 'Azione', 'Data', 'S', 'L']
Expand Down Expand Up @@ -107,11 +100,11 @@ def parseResults(self, results, entries, movie, title):
elif column_name is 'Size':
new['size'] = self.parseSize(td.text)
elif column_name is 'Azione':
# retrieve download link
#retrieve download link
new['detail_url'] = td.find('form')['action']
new['id'] = new['detail_url'].split('/')[4]
# fare richiesta detail url e prendere link magnet
new['url'] = self.getMagnetLink(new['detail_url'])
hash = td.find('input', attrs={'class': 'downarrow'})['value']
new['url'] = 'http://itorrents.org/torrent/%s.torrent' % hash
elif column_name is 'Data':
new['age'] = self.ageToDays(td.find('font').text)
elif column_name is 'S':
Expand Down

0 comments on commit c54f92d

Please sign in to comment.