def parse_collection(command): result = Match.collection(command) collection_id = result.group('collection_id') task = SingleTask() task.kind = 'collection' task.spider.href = 'https://www.zhihu.com/collection/{}'.format(collection_id) task.book.kind = 'collection' task.book.sql.info = 'select * from CollectionInfo where collection_id = "{}"'.format( collection_id) task.book.sql.question = 'select * from Question where question_id in (select question_id from Answer where href in (select href from CollectionIndex where collection_id = "{}"))'.format( collection_id) task.book.sql.answer = 'select * from Answer where href in (select href from CollectionIndex where collection_id = "{}")'.format( collection_id) return task
def parse_collection(command): result = Match.collection(command) collection_id = result.group('collection_id') task = SingleTask() task.kind = 'collection' task.spider.href = 'https://www.zhihu.com/collection/{}'.format( collection_id) task.book.kind = 'collection' task.book.sql.info = 'select * from CollectionInfo where collection_id = "{}"'.format( collection_id) task.book.sql.question = 'select * from Question where question_id in (select question_id from Answer where href in (select href from CollectionIndex where collection_id = "{}"))'.format( collection_id) task.book.sql.answer = 'select * from Answer where href in (select href from CollectionIndex where collection_id = "{}")'.format( collection_id) return task
def parse_collection(command): result = Match.collection(command) collection_id = result.group(u'collection_id') task = CollectionTask(collection_id) return task