Skip to content

Commit

Permalink
Fixed bithdtv provider.
Browse files Browse the repository at this point in the history
* needed to use html.parser
* need to explicitly get the second table. Not the table with the filters.
  • Loading branch information
p0psicles committed Jun 1, 2016
1 parent 273a600 commit 913986e
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions sickbeard/providers/bithdtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-man
logger.log('No data returned from provider', logger.DEBUG)
continue

with BS4Parser(response.text, 'html5lib') as html:
torrent_table = html.find('table', width='750')
# Need the html.parser, as the html5parser has issues with this site.
with BS4Parser(response.text, 'html.parser') as html:
torrent_table = html('table', width='750')[-1] # Get the last table with a width of 750px.
torrent_rows = torrent_table('tr') if torrent_table else []

# Continue only if at least one Release is found
Expand Down Expand Up @@ -155,29 +156,28 @@ def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-man

return results

def login(self):
"""Login method used for logging in before doing search and torrent downloads"""
if any(dict_from_cookiejar(self.session.cookies).values()):
return True

def login(self):
"""Login method used for logging in before doing search and torrent downloads"""
if any(dict_from_cookiejar(self.session.cookies).values()):
return True

login_params = {
'username': self.username.encode('utf-8'),
'password': self.password.encode('utf-8'),
}
login_params = {
'username': self.username.encode('utf-8'),
'password': self.password.encode('utf-8'),
}

response = self.get_url(self.urls['login'], post_data=login_params, returns='text')
if not response:
logger.log(u'Unable to connect to provider', logger.WARNING)
self.session.cookies.clear()
return False
response = self.get_url(self.urls['login'], post_data=login_params, returns='text')
if not response:
logger.log(u'Unable to connect to provider', logger.WARNING)
self.session.cookies.clear()
return False

if '<h2>Login failed!</h2>' in response:
logger.log(u'Invalid username or password. Check your settings', logger.WARNING)
self.session.cookies.clear()
return False
if '<h2>Login failed!</h2>' in response:
logger.log(u'Invalid username or password. Check your settings', logger.WARNING)
self.session.cookies.clear()
return False

return True
return True


provider = BithdtvProvider()

0 comments on commit 913986e

Please sign in to comment.