Scrapy Work Flow

Source: Internet
Author: User

Scrapy mainly has the following components:

1, Engine (scrapy)

Used to process the entire system's data flow, triggering transactions (framework core)

2, Scheduler (Scheduler)

Used to receive a request from the engine, pressed into the queue, and returned when the engine requests again, can be imagined as a URL (crawl web site URL or link) Priority queue, it determines the next crawl URL is what, while removing duplicate URLs

3, Downloader (Downloader)

To download the content of the Web page and return the contents of the Web page to the spider (Scrapy downloader is built again twisted) on this efficient asynchronous model

4, Reptile (Spiders)

Crawlers are primarily working to extract the information they need from a particular Web page, the so-called entity (Item). The user can also extract a link from it, allowing Scrapy to continue scratching a page

5, Project Pipeline (Pipeline)

Responsible for dealing with the entities extracted from the Web page, the main function is to persist the entity, verify the validity of the entity, and clear the unwanted information. When the page is parsed by the crawler, it is sent to the project pipeline, and the data is processed in several specific order.

6, Downloader middleware (Downloader middlewares)

A framework between the Scrapy engine and the downloader, primarily dealing with requests and responses between the Scarpy engine and the downloader

7, crawler middleware (spider middlewares)

A framework between the Scrapy engine and the crawler, mainly working to handle the spider's response input and request output

8, Dispatch middleware (Scheduler middewares)

A dispatch request and response sent from the Scrapy engine between the middleware between the Scrapy engine and the dispatch.

The scrapy running process is probably as follows:
1, the engine pulls a link (URL) from the scheduler for the next crawl

2, the engine encapsulates the URL as a request to pass to the downloader

3, the Downloader downloads the resource and encapsulates it as a response packet (Response)

4, Reptile parsing response

5, the Entity (ITEM) is parsed, then the entity pipeline is processed further.

6, parse out a link (URL), then the URL to the scheduler waiting to crawl

Scrapy Work Flow

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.