Last active
August 29, 2015 14:13
-
-
Save yetone/651cdda189b702d50dba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'yetone' | |
from twisted.internet import reactor | |
from scrapy import log, signals | |
from scrapy.crawler import Crawler | |
from scrapy.xlib.pydispatch import dispatcher | |
from scrapy.utils.project import get_project_settings | |
from araneae.spiders.aliexpress.item_list import ItemListSpider | |
def stop_reactor(): | |
reactor.stop() | |
dispatcher.connect(stop_reactor, signal=signals.spider_closed) | |
spider = ItemListSpider(url='http://activities.aliexpress.com/bestselling.php') | |
crawler = Crawler(get_project_settings()) | |
crawler.configure() | |
crawler.crawl(spider) | |
crawler.start() | |
log.start() | |
log.msg('Running reactor...') | |
reactor.run() # the script will block here until the spider is closed | |
log.msg('Reactor stopped.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment