-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (30 loc) · 1.11 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var express = require('express');
var app = express();
var request = require('request');
var cheerio = require('cheerio');
app.get('/',function(req,res){
request('http://www.jikexueyuan.com/course/',function(error,response,body){
if(!error && response.statusCode == 200){
$= cheerio.load(body);
var result = $('.bd');
result.each(function(item){
var str = $(this);
//console.log('111=='+item);
var s1=(str.find('.aside-cList li .list-show div'));
//console.log('22222==='+(str.find('.aside-cList li .list-show div')).length);
s1.each(function(item){
var str1 = $(this);
//console.log('33333==='+(str1.find('dl')));
var s2 = str1.find('dl');
s2.each(function(item){
var str2 = $(this);
console.log('33333==='+(str2.find('dt a').text()));
});
});
});
res.send('hello');
}
}) ;
});
//这是一个测试项目
app.listen(3001);