A tutorial on using Python's scrapy framework for 10 minutes to climb a beauty map

Source: Internet
Author: User

Brief introduction

Scrapy is a rich, quick and easy to use crawler framework underneath Python. With Scrapy can quickly develop a simple reptile, the official given a simple example is sufficient to prove its strong:

Rapid development

Here's the 10-minute countdown:

1. Initializing the project

Scrapy Startproject MZT
CD MZT
Scrapy Genspider Meizitu meizitu.com

2. Add Spider Code:

Define Scrapy. Item, add image_urls and images, and prepare for downloading pictures.

Modify Start_urls as the initial page, add parse to process the list page, add Parse_item process project page.

3. Modify the configuration file:

download_delay=1# Add Download Delay configuration
item_pipelines={' scrapy.pipelines.images.ImagesPipeline ': 1}# add picture Download pipeline
Images_store= '. ' # Set Picture Save directory

4. Run the project:

Scrapy Crawl Meizitu

See, Project Operation effect Chart

Waiting for a while, is the harvest time

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.