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, the sense of jumping of every note?

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 ("finish");}; ("/", (req, RES) = > {
console.log (req.body); 
res.send ("finish");};

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

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); / so / req.body, to use req.body to get the value of post transfer, ("/", (req, RES) = > ("));" ("completion");};

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.

 / / the magic module 
require ('superagent') used in site environment 
node v6.10.2
npm v3.10.10
require ('cheerio'); 
require ('express'); 
require ('ejs');'express'(E); (()); (());

Initialization project
NPM init
Installation module use
NPM install module name --save
Start app.js
Node app.js
You can play happily (the download link is at the end of the article).

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:

This page loaded in 0.000786 seconds