Basic concepts about the Scrapy framework

Source: Internet
Author: User

<title>Scrapy Crawling Web Basic concepts</title> Scrapy Crawl page Basic Concepts How do I build project with Scrapy?
scrapy startproject xxx
How do I crawl pages with scrapy?
import scrapy
fromimport CrawlSpider
fromimport Request
fromimport Selector

xxx=selector.xpath(xxxxx).extract()
File structure of the Scrapy

Project includes the following:

    • items.py
    • settings.py
    • pipelines.py
1. items.py

Item objects is simple containers used to collect the scraped data. They provide a dictionary-like API with a convenient syntax for declaring their available Fields.--scrapy official brochure

items.py defines data that needs to be crawled and needs to be processed later

2. settings.py

The Scrapy settings allows you and customize the behaviour of all scrapy components, including the core, extensions, Pipeli NES and Spiders Themselves.--scrapy official brochure

settings.py file Configuration scrapy, modify User-agent, set crawl interval, set agent, configure various middleware, etc.

3. pipelines.py

After an item have been scraped by a spider, it's sent to the item Pipeline which process it through several components th At is executed Sequentially.--scrapy official brochure

The pipelines.py is used to store the function of performing post-processing, which separates the data from crawling and processing.

Basic concepts about the Scrapy framework

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.