先获得歌手列表,将歌手列表存贮到本地
var request = require('request');
var cheerio = require('cheerio');
var path = require('path');
var fs = require('fs');
var out = fs.createWriteStream('./test1.txt');
var listUrl=new Array();
var filenames=new Array();
var requrl="http://www.kugou.com/yy/singer/index/1-a-1.html";
var headurlbase= 'http://www.kugou.com/yy/singer/index/'
var singerList=new Array()
var page_Num=0;
var reqlist=[]
for(let i=97;i<123;i++){
var headbasestring= String.fromCharCode(i)
var headurl = headurlbase+'1-'+headbasestring+'-1.html'
//console.log( 'headurl : ' +headurl );
for (let j=1;j<=5;j++){
requrl = headurlbase+j+'-'+headbasestring+'-1.html'
reqlist.push(requrl);
//console.log('curent url is ' + requrl)
}
for(let k=2; k<12;k++){
requrl = headurlbase+'1-'+headbasestring+'-'+k+'.html'
reqlist.push(requrl);
//console.log('curent url is ' + requrl)
}
}
console.log('End....'+reqlist.length);
//for(let i=0; i< reqlist.length;i++){
for(let i=0; i< 390;i++){
console.log(' i = ['+i+'] current get the url : ---'+reqlist[i])
getHtmlPage(reqlist[i])
}
function getHtmlPage(url){
request(url, function (error, res