def build_chapters(self): logging.debug('building chapters for textbook "{}"'.format(self.name)) soup = Base.soup_from_url(self.page) ul = soup.find('ul', {'class':'ulSumSbj'}) chapters = [] for li in ul.findAll('li', recursive=False): chapter = Chapter.from_tag(li) chapter.textbook = self chapters.append(chapter) self.chapters = chapters
def build_topics(self): logging.debug('building topics for chapter "{}"'.format(self.name)) soup = Base.soup_from_url(self.page) ul = soup.find('ul', {'class':'sumObjUl'}) lis = ul.findAll('li', recursive=False) uls = ul.findAll('ul', recursive=False) topics = [] for index in range(0, len(lis)): topic = Topic.from_tags(lis[index],uls[index]) topic.chapter = self topics.append(topic) self.topics = topics
def build_tree(self): logging.debug('building tree') self.soup = Base.soup_from_url(Base.SITE_INDEX) self.sections = self.get_sections()