fixed bithdtv provider
This commit is contained in:
1 parent
6acc125d4f
commit
a2c5074d66
2 files changed
+28
-22
No files matched your search
@@ -8,7 +8,6 @@ config = [{
|
|||||||
'groups': [
|
'groups': [
|
||||||
{
|
{
|
||||||
'tab': 'searcher',
|
'tab': 'searcher',
|
||||||
'subtab': 'providers',
|
|
||||||
'list': 'torrent_providers',
|
'list': 'torrent_providers',
|
||||||
'name': 'BiT-HDTV',
|
'name': 'BiT-HDTV',
|
||||||
'description': 'See <a href="http://bit-hdtv.com">BiT-HDTV</a>',
|
'description': 'See <a href="http://bit-hdtv.com">BiT-HDTV</a>',
|
||||||
@@ -53,4 +52,4 @@ config = [{
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}]
|
}]
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
from datetime import datetime
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from couchpotato.core.helpers.encoding import tryUrlencode
|
from couchpotato.core.helpers.encoding import tryUrlencode
|
||||||
from couchpotato.core.helpers.variable import tryInt
|
from couchpotato.core.helpers.variable import tryInt
|
||||||
@@ -8,34 +7,33 @@ import traceback
|
|||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BiTHDTV(TorrentProvider):
|
class BiTHDTV(TorrentProvider):
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
'test' : 'http://www.bit-hdtv.com/',
|
'test' : 'http://www.bit-hdtv.com/',
|
||||||
'login' : 'http://www.bit-hdtv.com/takelogin.php',
|
'login' : 'http://www.bit-hdtv.com/takelogin.php',
|
||||||
|
'login_check': 'http://www.bit-hdtv.com/messages.php',
|
||||||
'detail' : 'http://www.bit-hdtv.com/details.php?id=%s',
|
'detail' : 'http://www.bit-hdtv.com/details.php?id=%s',
|
||||||
'search' : 'http://www.bit-hdtv.com/torrents.php?search=%s&cat=%s&sub=%s',
|
'search' : 'http://www.bit-hdtv.com/torrents.php?',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Searches for movies only - BiT-HDTV's subcategory and resolution search filters appear to be broken
|
# Searches for movies only - BiT-HDTV's subcategory and resolution search filters appear to be broken
|
||||||
cat_id_movies = 7
|
cat_id_movies = 7
|
||||||
cat_ids = [
|
|
||||||
([16], ['720p', '1080p', 'brrip']),
|
|
||||||
([17], ['cam', 'r5', 'scr', 'dvdrip', 'dvdr']),
|
|
||||||
([19], ['ts', 'tc']),
|
|
||||||
]
|
|
||||||
|
|
||||||
http_time_between_calls = 1 #seconds
|
http_time_between_calls = 1 #seconds
|
||||||
cat_backup_id = None
|
|
||||||
|
|
||||||
def _searchOnTitle(self, title, movie, quality, results):
|
def _searchOnTitle(self, title, movie, quality, results):
|
||||||
|
|
||||||
url = self.urls['search'] % (tryUrlencode('%s %s' % (title.replace(':', ''), movie['library']['year'])), self.cat_id_movies, self.getCatId(quality['identifier'])[0])
|
arguments = tryUrlencode({
|
||||||
|
'search': '%s %s' % (title.replace(':', ''), movie['library']['year']),
|
||||||
|
'cat': self.cat_id_movies
|
||||||
|
})
|
||||||
|
|
||||||
|
url = "%s&%s" % (self.urls['search'], arguments)
|
||||||
|
|
||||||
data = self.getHTMLData(url, opener = self.login_opener)
|
data = self.getHTMLData(url, opener = self.login_opener)
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
|
|
||||||
# Remove BiT-HDTV's output garbage so outdated BS4 versions successfully parse the HTML
|
# Remove BiT-HDTV's output garbage so outdated BS4 versions successfully parse the HTML
|
||||||
split_data = data.partition('-->')
|
split_data = data.partition('-->')
|
||||||
if '## SELECT COUNT(' in split_data[0]:
|
if '## SELECT COUNT(' in split_data[0]:
|
||||||
@@ -44,17 +42,16 @@ class BiTHDTV(TorrentProvider):
|
|||||||
html = BeautifulSoup(data)
|
html = BeautifulSoup(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result_table = html.find('table', attrs = {'width' : '750', 'class' : ''})
|
result_table = html.find('table', attrs = {'width' : '750', 'class' : ''})
|
||||||
if not result_table:
|
if result_table is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
entries = result_table.find_all('tr')
|
entries = result_table.find_all('tr')
|
||||||
|
|
||||||
for result in entries[1:]:
|
for result in entries[1:]:
|
||||||
|
|
||||||
cells = result.find_all('td')
|
cells = result.find_all('td')
|
||||||
link = cells[2].find('a')
|
link = cells[2].find('a')
|
||||||
torrent_id = link['href'].replace('/details.php?id=', '')
|
torrent_id = link['href'].replace('/details.php?id=', '')
|
||||||
torrent_age = datetime.now() - datetime.strptime(cells[5].get_text(), '%Y-%m-%d %H:%M:%S')
|
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'id': torrent_id,
|
'id': torrent_id,
|
||||||
@@ -62,20 +59,30 @@ class BiTHDTV(TorrentProvider):
|
|||||||
'url': cells[0].find('a')['href'],
|
'url': cells[0].find('a')['href'],
|
||||||
'detail_url': self.urls['detail'] % torrent_id,
|
'detail_url': self.urls['detail'] % torrent_id,
|
||||||
'size': self.parseSize(cells[6].get_text()),
|
'size': self.parseSize(cells[6].get_text()),
|
||||||
'age': torrent_age.days,
|
|
||||||
'seeders': tryInt(cells[8].string),
|
'seeders': tryInt(cells[8].string),
|
||||||
'leechers': tryInt(cells[9].string),
|
'leechers': tryInt(cells[9].string),
|
||||||
|
'get_more_info': self.getMoreInfo,
|
||||||
})
|
})
|
||||||
|
|
||||||
except:
|
except:
|
||||||
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))
|
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))
|
||||||
|
|
||||||
def getLoginParams(self):
|
def getLoginParams(self):
|
||||||
return tryUrlencode({
|
return tryUrlencode({
|
||||||
'username': self.conf('username'),
|
'username': self.conf('username'),
|
||||||
'password': self.conf('password'),
|
'password': self.conf('password'),
|
||||||
'login': 'submit',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def getMoreInfo(self, item):
|
||||||
|
full_description = self.getCache('bithdtv.%s' % item['id'], item['detail_url'], cache_timeout = 25920000)
|
||||||
|
html = BeautifulSoup(full_description)
|
||||||
|
nfo_pre = html.find('table', attrs = {'class':'detail'})
|
||||||
|
description = toUnicode(nfo_pre.text) if nfo_pre else ''
|
||||||
|
|
||||||
|
item['description'] = description
|
||||||
|
return item
|
||||||
|
|
||||||
def loginSuccess(self, output):
|
def loginSuccess(self, output):
|
||||||
return 'logout.php' in output.lower()
|
return 'logout.php' in output.lower()
|
||||||
|
|
||||||
|
loginCheckSuccess = loginSuccess
|
||||||
Reference in new issue
Block a user