diff --git a/sickbeard/providers/thinkgeek.py b/sickbeard/providers/thinkgeek.py index 48fae089175c1354276991e42af3d6cb935767da..60fbc0f2c858a0ed35d6a8d3914fb27413cf67ee 100644 --- a/sickbeard/providers/thinkgeek.py +++ b/sickbeard/providers/thinkgeek.py @@ -52,7 +52,7 @@ class THINKGEEKProvider(generic.TorrentProvider): def getSearchParams(self, searchString, audio_lang, french=None, fullSeason=False): results = [] if audio_lang == "en" and french==None: - results.append( urllib.urlencode( { + results.append( urllib.urlencode( { 'keywords': searchString , } ) + "&cid=34,62&[PARAMSTR]=" + searchString ) elif audio_lang == "fr" or french: @@ -139,7 +139,7 @@ class THINKGEEKProvider(generic.TorrentProvider): r = self.opener.open( searchUrl ) - soup = BeautifulSoup( r, "html.parser" ) + soup = BeautifulSoup( r) resultsTable = soup.find("div", { "id" : "content" }) if resultsTable: @@ -151,24 +151,26 @@ class THINKGEEKProvider(generic.TorrentProvider): link = row.find("a",href=re.compile("action=details")) if link: - title = link.text - recherched=searchUrl.split("&[PARAMSTR]=")[1] - recherched=recherched.replace(".","(.*)").replace(" ","(.*)").replace("'","(.*)") - logger.log(u"THINKGEEK TITLE : " + title, logger.DEBUG) - logger.log(u"THINKGEEK CHECK MATCH : " + recherched, logger.DEBUG) - if re.match(recherched,title , re.IGNORECASE): - downloadURL = row.find("a",href=re.compile("action=download"))['href'] - logger.log(u"THINKGEEK DOWNLOAD URL : " + title, logger.DEBUG) - quality = Quality.nameQuality( title ) - if quality==Quality.UNKNOWN and title: - if '720p' not in title.lower() and '1080p' not in title.lower(): - quality=Quality.SDTV - if show and french==None: - results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) ) - elif show and french: - results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality, 'fr' ) ) - else: - results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality ) ) + title = link.text + recherched=searchUrl.split("&[PARAMSTR]=")[1] + recherched=recherched.replace(".","(.*)").replace(" ","(.*)").replace("'","(.*)") + logger.log(u"THINKGEEK TITLE : " + title, logger.DEBUG) + logger.log(u"THINKGEEK CHECK MATCH : " + recherched, logger.DEBUG) + if re.match(recherched,title , re.IGNORECASE): + downloadURL = row.find("a",href=re.compile("action=download"))['href'] + else: + continue + logger.log(u"THINKGEEK DOWNLOAD URL : " + title, logger.DEBUG) + quality = Quality.nameQuality( title ) + if quality==Quality.UNKNOWN and title: + if '720p' not in title.lower() and '1080p' not in title.lower(): + quality=Quality.SDTV + if show and french==None: + results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) ) + elif show and french: + results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality, 'fr' ) ) + else: + results.append( THINKGEEKSearchResult( self.opener, title, downloadURL, quality ) ) return results def getResult(self, episodes):