The path of the small white Python crawler--The first knowledge of reptile principle

Source: Internet
Author: User

Crawlers do two things.

① impersonate a computer to initiate request requests to the server

② receive server-side response content and parse to extract the required information

Internet pages are complicated, and a single request cannot get all the information. You need to design a crawler process.

This book mainly introduces two kinds of smooth ① multi-page crawler Process ② cross-page crawler process

Multi-page Crawler flow:

(1) Manually paging and observing the URL composition of each page to construct a URL to the list of all pages

(2) loop out the URL in turn based on the URL list

(3) Defining crawler functions

(4) Loop call crawler function, store data.

(5) The end of the cycle, the end of the reptile program.

A cross-page reptile program:

(1) Defining the feature URL of the Crawl Function crawl page (List page)

(2) Save the theme URL as a seed URL in the list

(3) Defining crawler functions

(4) Call the crawler function according to the seed URL to store the data.

(5) The end of the cycle, the end of the reptile program.

two different process differences: construct the URL list yourself, crawl the page URL list

The path of the small white Python crawler--The first knowledge of reptile principle

Related Article

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.