def init_request(self):
"""This function is called before crawling starts."""
# Do not start a request on error,
# simply return nothing and quit scrapy
if self.abort:
return
logging.info('All set, start crawling with depth: ' + str(self.max_depth))
# Do a login
if self.config['login']['enabled']:
# Start with login first
logging.info('Login required')
return Request(url=self.login_url, callback=self.login)
else:
# Start with pase function
logging.info('Not login required')
return Request(url=self.base_url, callback=self.parse)
#----------------------------------------------------------------------
评论列表
文章目录