def searchMovie(self, urlSearch): from time import sleep settings.log(message=urlSearch) settings.notification(message="Buscando en linea... %s" % urlSearch[urlSearch.rfind("/") + 1:]) tools.goodSpider() response = browser.get(settings.url_address, allow_redirects=True) response = browser.get(urlSearch, allow_redirects=True) if response.status_code == requests.codes.ok: soup = bs4.BeautifulSoup(response.text) links = soup.select('li.item-movies a.image-block') for link in links: self.url_list.append(link.attrs.get('href')) self.titles.append(link.attrs.get('title'))
def searchShow(self, urlSearch="", parameters=""): settings.log(message=urlSearch) settings.notification(message="Buscando en linea... %s" % urlSearch[urlSearch.rfind("/") + 1:]) tools.goodSpider() response = browser.post(url=urlSearch, data=parameters) # open the serie if response.status_code == requests.codes.ok: soup = bs4.BeautifulSoup(response.text) links = soup.select('a') for link in links: self.url_list.append(link.attrs.get('href')) if parameters == "": self.titles.append(link.span.text) else: self.titles.append(link.div.text.strip()) else: settings.log(">>>>>>>HTTP %s<<<<<<<" % response.status_code) settings.notification(message="HTTP %s" % response.status_code, force=True)
def searchEpisodes(self, urlSearch="", exclude="", erase=True): settings.log(message=urlSearch) settings.notification(message="Buscando en linea... %s" % urlSearch[urlSearch.rfind("/") + 1:]) if erase: self.url_list = [] self.titles = [] tools.goodSpider() response = browser.get(urlSearch) # open the serie if response.status_code == requests.codes.ok: soup = bs4.BeautifulSoup(response.text) if soup.select('tr.mainInfoClass a')[0].text <> exclude: links = soup.select('td.sape a') for link in links: self.url_list.append(link.attrs.get('href')) self.titles.append(link.text) else: settings.log(">>>>>>>HTTP %s<<<<<<<" % response.status_code) settings.notification(message="HTTP %s" % response.status_code, force=True)
def readOptions(url=""): result = (None, None) tools.goodSpider() response = browser.get(url) # open the serie if response.status_code == requests.codes.ok: soup = bs4.BeautifulSoup(response.text) years = {" TODAS": ""} links = soup.select('form#form_custom select#years option') links.pop(0) for link in links: years[link.text] = link.attrs.get("value") genres = {" TODAS": ""} links = soup.select('form#form_custom select#genres option') links.pop(0) for link in links: genres[link.text] = link.attrs.get("value") result = (years, genres) else: settings.log(">>>>>>>HTTP %s<<<<<<<" % response.status_code) settings.notification(message="HTTP %s" % response.status_code, force=True) return result