Toggle navigation
Toggle navigation
This project
Loading...
Sign in
SUJINKO(고수진)
/
abroad-checkup-project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
SUJINKO(고수진)
2020-12-10 13:56:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fd4adebc2cc2d0f54cdc998ea82119733d038219
fd4adebc
1 parent
308884a7
Replace index.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
AbroadCheckUp_crowling/index.js
AbroadCheckUp_crowling/index.js
View file @
fd4adeb
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
const
axios
=
require
(
"axios"
);
//읽어온 정보를 html로직으로 변환하여 화면작업을 하도록 유도합니다
const
cheerio
=
require
(
'cheerio'
);
router
.
get
(
'/'
,
function
(
req
,
res
,
next
)
{
let
url
=
'https://www.
yna.co.kr/sports/all
'
;
let
url
=
'https://www.
koreanair.com/korea/ko/2020_02_TSA_detail.html#par_titledparsys
'
;
axios
.
get
(
url
).
then
(
html
=>
{
let
ulList
=
[];
...
...
@@ -15,12 +14,9 @@ router.get('/', function(req, res, next) {
$bodyList
.
each
(
function
(
i
,
elem
)
{
ulList
[
i
]
=
{
//find : 해당 태그가 있으면 그 요소 반환
title
:
$
(
this
).
find
(
'strong.news-tl a'
).
text
(),
url
:
$
(
this
).
find
(
'strong.news-tl a'
).
attr
(
'href'
),
image_url
:
$
(
this
).
find
(
'p.poto a img'
).
attr
(
'src'
),
image_alt
:
$
(
this
).
find
(
'p.poto a img'
).
attr
(
'alt'
),
summary
:
$
(
this
).
find
(
'p.lead'
).
text
().
slice
(
0
,
-
11
),
date
:
$
(
this
).
find
(
'span.p-time'
).
text
()
country
:
$
(
this
).
find
(
'th_row_style'
).
text
(),
condition
:
$
(
this
).
find
(
''
).
text
(),
etc
:
$
(
this
).
find
(
''
).
text
()
};
});
...
...
Please
register
or
login
to post a comment