SUJINKO(고수진)

Replace index.js

1 var express = require('express'); 1 var express = require('express');
2 var router = express.Router(); 2 var router = express.Router();
3 const axios = require("axios"); 3 const axios = require("axios");
4 -//읽어온 정보를 html로직으로 변환하여 화면작업을 하도록 유도합니다
5 const cheerio = require('cheerio'); 4 const cheerio = require('cheerio');
6 5
7 router.get('/', function(req, res, next) { 6 router.get('/', function(req, res, next) {
8 - let url = 'https://www.yna.co.kr/sports/all'; 7 + let url = 'https://www.koreanair.com/korea/ko/2020_02_TSA_detail.html#par_titledparsys';
9 8
10 axios.get(url).then(html => { 9 axios.get(url).then(html => {
11 let ulList = []; 10 let ulList = [];
...@@ -15,12 +14,9 @@ router.get('/', function(req, res, next) { ...@@ -15,12 +14,9 @@ router.get('/', function(req, res, next) {
15 $bodyList.each(function(i, elem) { 14 $bodyList.each(function(i, elem) {
16 ulList[i] = { 15 ulList[i] = {
17 //find : 해당 태그가 있으면 그 요소 반환 16 //find : 해당 태그가 있으면 그 요소 반환
18 - title: $(this).find('strong.news-tl a').text(), 17 + country: $(this).find('th_row_style').text(),
19 - url: $(this).find('strong.news-tl a').attr('href'), 18 + condition: $(this).find('').text(),
20 - image_url: $(this).find('p.poto a img').attr('src'), 19 + etc: $(this).find('').text()
21 - image_alt: $(this).find('p.poto a img').attr('alt'),
22 - summary: $(this).find('p.lead').text().slice(0, -11),
23 - date: $(this).find('span.p-time').text()
24 }; 20 };
25 }); 21 });
26 22
......