def parse_author(command): result = Match.author(command) author_id = result.group('author_id') task = SingleTask() task.kind = 'author' task.spider.href = 'https://www.zhihu.com/people/{}'.format(author_id) task.book.kind = 'author' task.book.sql.info = 'select * from AuthorInfo where author_id = "{}"'.format(author_id) task.book.sql.question = 'select * from Question where question_id in (select question_id from Answer where author_id = "{}")'.format( author_id) task.book.sql.answer = 'select * from Answer where author_id = "{}"'.format(author_id) return task
def parse_author(command): result = Match.author(command) author_id = result.group('author_id') task = SingleTask() task.kind = 'author' task.spider.href = 'https://www.zhihu.com/people/{}'.format( author_id) task.book.kind = 'author' task.book.sql.info = 'select * from AuthorInfo where author_id = "{}"'.format( author_id) task.book.sql.question = 'select * from Question where question_id in (select question_id from Answer where author_id = "{}")'.format( author_id) task.book.sql.answer = 'select * from Answer where author_id = "{}"'.format( author_id) return task
def parse_author(command): result = Match.author(command) author_page_id = result.group(u'author_page_id') task = AuthorTask(author_page_id) return task