def hotel_reviews(self): if not self.reviews: self.reviews = list() while True: # test whether the page need ajax request temp_reviews = self.get_review() self.reviews.extend(temp_reviews) try: next_page = TAutil.next_page(self.soup) except TypeError: break self.parse_init(next_page, False) return self.reviews
def hotel_urls(self): if not self.urls: self.urls = list() while True: hotels = self.soup.find_all(id=re.compile(r'hotel_\d*')) temp_urls = [self.find_hotel_url(x) for x in hotels if self.large_reviews(x)] self.urls.extend(temp_urls) try: next_page = TAutil.next_page(self.soup) except TypeError: break self.parse_init(next_page) return self.urls