code: def _run_spider_in_reactor(spider_cls, capture_items=True, return_crawler=False,
                             settings=None, **kwargs):
      
      settings = settings or {}
      crawler_settings = get_project_settings().copy()
      crawler_settings.setdict(default_settings)
      crawler_settings.setdict(settings)
      log_scrapy_info(crawler_settings)
      crawler = Crawler(spider_cls, crawler_settings)
      d = crawler.crawl(**kwargs)
      if capture_items:
          crawler.items = _OutputItems()
          crawler.signals.connect(crawler.items.append, signal=signals.item_scraped)
          d.addCallback(lambda _: crawler.items)
      if return_crawler:
          d.addCallback(lambda _: crawler)
      return d
docs: Runs given spider inside the twisted reactdor.
  
      Parameters
      ----------
      spider_cls : scrapy.Spider
          Spider to run.
      capture_items : bool (default: True)
          If enabled, the scraped items are captured and returned.
      return_crawler : bool (default: False)
          If enabled, the crawler instance is returned. If ``capture_items`` is
          enabled, the scraped items is collected in ``crawler.items``.
      settings : dict, optional
          Custom crawler settings.
  
      Returns
      -------
      out : crochet.EventualResult
          If ``capture_items`` is ``True``, returns scraped items. If
          ``return_crawler`` is ``True``, returns the crawler instance.