def convertToSeed(self, soupObj): assert soupObj is not None trList = soupObj.select("table.torrents tr") seedList = [] cnt = 0 for tr in trList: cnt += 1 if cnt == 1: # skip the caption tr continue seed = SeedInfo() tdList = tr.select("td.rowfollow") if len(tdList) < 9: # skip embedded contents continue seed.title = tdList[1].select("table td a")[0]["title"] seed.url = self.siteRequest.baseUrl + tdList[1].select( "table td a")[0]['href'] seed.free = len(tdList[1].select("table font.free")) > 0 seed.hot = len(tdList[1].select("table font.hot")) > 0 seed.since = Utils.getContent(tdList[3], "span") seed.size = float(self.parseSize(tdList[4])) seed.uploadNum = int( self.getContentWithoutFontorStrong(tdList[5], "a")) seed.downloadNum = int( self.getContentWithoutFontorStrong(tdList[6], "a")) seed.finishNum = int( self.getContentWithoutFontorStrong(tdList[7], "a")) seed.id = self.parseId(seed.url) # print('\n'.join(['%s:%s' % item for item in seed.__dict__.items()]) + "\n") seedList.append(seed) return seedList
def checkLogin(siteRequest): content = Utils.getContent(Utils.urlGet(siteRequest.homePage), siteRequest.loginVerificationCss) return content is not None and content == siteRequest.loginVerificationStr