示例#1
0
 def get_book_info(soup):
     book_info = BookInfo()
     book_info.title = Retriever.get_field(soup, u'Название:')
     authors = Retriever.get_field(soup, u'Автор\(ы\):')
     if authors:
         book_info.authors = [ authors ]
     book_info.summary = Retriever.get_field(soup, u'Описание:')
     book_info.language = Retriever.get_field(soup, u'Язык:')
     format = Retriever.get_field(soup, u'Формат:')
     link = Retriever.get_field(soup, u'Ссылка 1:', False).a['href']
     book_info.links = {format : link}
     return book_info
示例#2
0
 def execute(self,html):
     soup = get_soup(html)
     book_info = BookInfo()
     book_info.title  = self.description['title']
     book_info.authors = [ "%s %s %s" % (self.description['firstname'],self.description['middlename'], self.description['lastname']) ]
     book_info.pagelink = self.link
     book_info.language = self.description['language']
     book_info.summary = Retriever.get_summary(soup)
     book_info.links = Retriever.get_links(soup, self.link)
     book_info.tags = Retriever.get_tags(soup)
     book_info.image = Retriever.get_picture(soup, self.link, self.description['ID'])
     self.tasks = [ BookSavingTask(book_info) ]
     return True