No. 353, Python distributed crawler build search engine scrapy explaining-scrapy pause and restart

Source: Internet
Author: User

No. 353, Python distributed crawler build search engine scrapy explaining-scrapy pause and restart

Every reptile in the scrapy can record the paused state and which URLs are crawled when paused, the URLs that can be crawled from the paused state when the restart is not crawled

Implementing pause and restart record status

1, first CD into the scrapy project

2. Create a folder to save the record information in the Scrapy project

3. Execute the command:

  Scrapy Crawl crawler name-S jobdir= path to save record information

such as:scrapy crawl cnblogs-s jobdir=zant/001

The Execute command launches the specified crawler and logs the status to the specified directory

The crawler has started, we can press CTRL + C to stop the crawler

Stop after we look at the record folder, there will be 3 more files

The P0 file in the Requests.queue folder is the URL record file, and the file exists to indicate that there is an unfinished URL that will be automatically deleted when all URLs are complete.

When we re-execute the command:scrapy crawl cnblogs-s jobdir=zant/001 The crawler will continue crawling based on the P0 file from where it was stopped,

No. 353, Python distributed crawler build search engine scrapy explaining-scrapy pause and restart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.