question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to run Multiple spider ** independently ** at the same time ?

See original GitHub issue

when i wrote two simple spider

class Bing(Spider):

    name = "bing"

    def start_requests(self):
        for _ in range(1000):
            yield Request("http://bing.com", dont_filter=True)

    def parse(self, response):
        print(self.name, response.url)

class Sogou(Spider):
    name = "sogou"
    def start_requests(self):
        for _ in range(1000):
            yield Request('http://sogou.com', dont_filter=True)

    def parse(self, response):
        while True:
            print('123')
        print(self.name, response.url)
def run(spider_cls):
    crawler = Crawler(spider_cls)
    crawler.crawl()

run(Bing)
run(Sogou)

reactor.run()

just like this. Use Crawler and reactor to run these spider. Sogou spider was blocked, it was obvious. but Bing spider was blocked too, why ? and how to solve it . use Crawler class make multiple spider run independently at the same time? I used to use twisted.threads like deferToThread , or callInThread , it couldn’t work . Can someone have some idea? Thank you very much!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
grammy-jiangcommented, Apr 14, 2018

hi, @xiaochonzi

Please refer to the section Running multiple spiders in the same process in the document Common Practices — Scrapy 1.5.0 documentation. There is a very clear example for your question.

5reactions
grammy-jiangcommented, Apr 15, 2018

Hi, @xiaochonzi

Please, please read the section I mentioned before CAREFULLY. The document provides a very clear way to do what you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do we have an option to run multiple spiders "independently ...
I currently running 300+ spiders sequentially and dynamically from a django database. I also tried to run the spiders simultaneously using ...
Read more >
how to run multiple spiders concurrently in code?
Short answer: Running multiple spiders into the same scrapy crawl process is no longer supported (since 0.14) in favour of using scrapyd
Read more >
Common Practices — Scrapy 2.7.1 documentation
The first utility you can use to run your spiders is scrapy.crawler.CrawlerProcess . ... Here is an example that runs multiple spiders simultaneously:....
Read more >
Run Scrapy Spiders from Python Script - YouTube
Learn how to call Scrapy spider from main.py, a question that I get often. You will learn how to run Scrapy multiple spiders...
Read more >
How to Run Scrapy as a Stand-Alone Script | Teracrawler
Let's take a simple scrapy crawler that crawls quotes and see if we can make it run standalone… import scrapy from scrapy.spiders import ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found