Node. js crawls Douban data and node. js crawls Douban data.

Source: Internet
Author: User

Node. js crawls Douban data and node. js crawls Douban data.

I have always thought that my vue is okay, and I have always thought that my webpack is okay. Today, when I visited node in MOOC, I found that I am still far away. As we all know, vue-cli is based on webpack, while webpack is based on node, so we don't know much about node and what we know about webpack. So I gave myself a question and crawled the Douban data. It is still in its infancy. Today, let's talk about the data crawled from Douban and show it on another page in our own way. We will follow up later.

1. Problems to be Solved

1. Build services

②. How to process crawled data

③ How to automatically open the default browser

2. Build services

There are several ways to build services. At first I used http, but the disadvantage of http is that it cannot parse the https url, so I used express, I used the request package to parse the https protocol. The URL of Douban is https,

The crawler crawled today is.

3. How to process crawled data

How can we process the data that we crawled using the request? The cheerio package allows us to process crawled html data like Jq.

1. parse the data and obtain the html data of the crawled webpage;

② Use the cheerio package to operate the crawled data and obtain the data you want.

③ Obtain the data, Create html, and output the data to the page. For example, the method for concatenating strings is a bit stupid and there is no better way yet.

4. How to automatically open the default browser

I wonder if you have checked the webpack configuration in vue-cli and opened the browser automatically.

This package is very convenient to use. Introduce the package and directly call the UDF (url;

5. Presentation

Follow the Public Accounts

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.