def get_text(self, url): response = Splash.get(url) if response.headers.get('content-type') == "pplication/json": r = json.loads(response.content) error = r.get("error") if error: raise Exception(error) soup = BeautifulSoup(response.content, "html.parser") remove_exclude_tags(soup) return soup.get_text()
def search(self, keyword, start=0, num=20): query = self.create_search_url(keyword, start=start, num=num) return Splash.get(query)