0

I'm looking for an example to run scrapy script via HTTP request. I'm planing to send url as a parameter that i need to crawl, via GET or POST method. How can i do that.

2
  • 1
    scrapyRT does exactly that: github.com/scrapinghub/scrapyrt Commented Dec 12, 2018 at 13:23
  • Biswanath is correct, scrapyd would be very useful for you Commented Dec 14, 2018 at 6:51

2 Answers 2

3

You should use scrapyd.

Link to the GitHub project page.

Once you are using scrapyd you can use this api to scedule a crawl.

Sign up to request clarification or add additional context in comments.

Comments

0

Try something like that.

from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy import log, signals
from testspiders.spiders.followall import FollowAllSpider
from scrapy.utils.project import get_project_settings

spider = FollowAllSpider(domain='url.com')
settings = get_project_settings()
crawler = Crawler(settings)
crawler.signals.connect(reactor.stop, signal=signals.spider_closed)
crawler.configure()
crawler.crawl(spider)
crawler.start()
log.start()
reactor.run()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.