May 2017

I don't know if you've met anyone. Some people in NetEase cloud have a partial idea of ballads, and their minds are limited to playing guitar and singing NMP.

When I came to the songs of Celtic Style, it was a clear stream. How could such a wonderful song, every musical note jump, ah? A kind of It's a bang bang.

In the domestic ballad environment, listen again, always feel that a group of people are moaning and groaning, not decadent or decadent.

Of course, there are such distinctive singers as porridge and Yan Chi.

In fact, I really liked the styles of Scotland and Ireland playing. These folk songs are not much more interesting than some guitar based folk songs in China.

Wiki: ( celtic [Chinese )

If there is novice learning Nodejs Get URL post When the parameters are returned, the same problem will happen to me, and today we will solve this problem.

Node.js Unlike PHP This old backend language has a specific way to obtain external parameters, after all, it is a new force, hoping that the later version will be more convenient and efficient.

 / / normal acquisition value. App.get ('/', (req, RES) = { Console.log ( Req.query ) Res.send (completion); ('/', (req, RES) = { Console.log ( Req.body ) Res.send (completion);

If you want to export normally, your anticipation is like this.

 / / GET request 
name: 'Feng Xiaoxian', 


 / / POST request 
name: 'Feng Xiaoxian', 

However, it is not!!!

 / / the two output will be like this!!! {}

This is because we lack a module, express middleware. Body-parser

Official statement
Node.js Body parsing middleware.
Parse incoming request bodies in a middleware before your handlers, available handlers Req.body Property.

Basically, parsing the content of the body in the client request, JSON encoding and URL encoding processing.

Next we will install. Body-parser

 / / install body-parser
npm install body-parser

 / / import App.js
 Var bodyParser = require ('body-parser'); App.use (bodyParser ()); Req.body To get the value of post delivery. ('/', (req, RES) = { Console.log ( Req.body ) Res.send ("finish"); "JSON" is used. App.use ( BodyParser.json ())

Learning without motivation, eating jujube is? In the process of learning nodejs, I will give you a little refreshing.

Here I use the cnodejs community's simplest crawler tutorial to do the basic modification of eel.

 / / initialization project 
npm init
// startup App.js
 Node App.js
 / / you can be happy. A kind of Play fast (see the end of the code)

If you don't know how to use nodejs
Linux players can see My article Windows players can download.Msi directly to the official website, and install next step. Through train

Basic crawling ideas

  1. The paging button of the page catches all the little sister's page links appearing on this page and stores them.
  2. Using eventproxy to visit every little sister's page concurrently
  3. During the visit, we use cheerio (similar to jQuery module) to match the picture address we need, and record all the pictures found.
  4. HTTP requests every picture address to save binary data stream.
  5. FS outputs binary data streams into picture files, and the name of the files is extracted from the original address.
  6. Save to folder

Here, I am afraid that because the request is too large, we can use express to build static pages. query and download To reduce the possibility of crawling sites being crawled to death.

Download address: