mytoons.js
1.03 KB
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
35
36
37
38
39
40
41
var express = require('express');
var cheerio = require('cheerio');
var request = require('request');
var router = express.Router();
updatedToons = getUpdatedToons();
function getUpdatedToons(){
var allToons = new Array();
var allToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn";
request(allToonsUrl, function(err, res, html){
if(!err){
var $ = cheerio.load(html);
$(".thumb").has('.ico_updt').next().each(function() {
var link = $(this);
var toonName = link.text();
var toonHref = link.attr('href');
allToons[toonName]=toonHref;
//connection.query("");
});
}
});
return allToons;
}
function getMyToons(id){
var sql = "";
connection.query('SELECT * FROM user u, user_toon_relation ur WHERE u.id=ur.user_id && id=?;');
}
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('mytoons',{
list : updatedToons
});
});
module.exports = router;