Use the Python Scrapy framework to crawl the beauty chart in ten minutes, pythonscrapy

Source: Internet
Author: User
Tags python scrapy

Use the Python Scrapy framework to crawl the beauty chart in ten minutes, pythonscrapy

Introduction

Scrapy is a python crawler framework with rich functions and convenient use. Scrapy can be used to quickly develop a simple crawler. An official simple example is enough to prove its strength:

Quick Development

The next 10-minute countdown starts:

Of course, before you start, you can first read the scrapy getting started article "Writing python crawlers using the Scrapy framework ".

1. initialize the project

scrapy startproject mztcd mztscrapy genspider meizitu meizitu.com

2. Add the spider code:

Define scrapy. Item and add image_urls and images to prepare for downloading the image.

Modify start_urls as the initial Page, add parse to process the list page, and add parse_item to process the project page.

3. modify the configuration file:

DOWNLOAD_DELAY = 1 # Add the download delay configuration ITEM_PIPELINES = {'scrapy. pipelines. images. ImagesPipeline ': 1} # Add an image download pipelineIMAGES_STORE ='. '# Set the image storage directory

4. Run the project:

scrapy crawl meizitu

See, project run

Wait for a while, it's time to reap


Summary

The above is all about this article. I hope this article will help you in your study or work. If you have any questions, please leave a message.

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.