Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이태화
/
khu-notice-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
이태화
2020-10-30 23:40:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
872f61ca9bdb7e7a8e73a8ed4ae7c140c9dea43d
872f61ca
1 parent
ff8962e4
database server needed
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
43 deletions
webcrawling-practice/main.js
webcrawling-practice/notepad.js
webcrawling-practice/swuniv.js → webcrawling-practice/silte_modules/swuniv.js
webcrawling-practice/syncTest.js
webcrawling-practice/main.js
View file @
872f61c
const
swuniv
=
require
(
'./swuniv.js'
);
const
swuniv
=
require
(
'./silte_modules/swuniv.js'
)
async
function
loading
(){
li
=
await
swuniv
.
loading
();
console
.
log
(
li
);
}
loading
();
console
.
log
(
swuniv
);
...
...
webcrawling-practice/notepad.js
0 → 100644
View file @
872f61c
File mode changed
webcrawling-practice/swuniv.js
→
webcrawling-practice/s
ilte_modules/s
wuniv.js
View file @
872f61c
...
...
@@ -9,10 +9,11 @@ var getHTML = async function(link){
}
}
getHTML
(
"http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1"
).
then
(
function
(
HTML
){
async
function
getList
(
link
){
list
=
[];
HTML
=
await
getHTML
(
link
);
var
$
=
cheerio
.
load
(
HTML
.
data
);
var
titleList
=
$
(
'tr'
);
var
list
=
[];
titleList
.
each
(
function
(
i
,
elem
){
list
[
i
]
=
{
title
:
$
(
this
).
find
(
".bo_tit"
).
text
().
replace
(
/
(\r\n\t
|
\n
|
\r\t)
/gm
,
""
).
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/gi
,
""
),
...
...
@@ -21,24 +22,13 @@ getHTML("http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1").
site
:
'소프트웨어 융합대학 공지사항'
}
})
});
getHTML
(
"http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=2"
).
then
(
function
(
HTML
){
var
$
=
cheerio
.
load
(
HTML
.
data
);
var
titleList
=
$
(
'tr'
);
var
list
=
[];
titleList
.
each
(
function
(
i
,
elem
){
list
[
i
]
=
{
title
:
$
(
this
).
find
(
".bo_tit"
).
text
().
replace
(
/
(\r\n\t
|
\n
|
\r\t)
/gm
,
""
).
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/gi
,
""
),
link
:
$
(
this
).
find
(
"a"
).
attr
(
'href'
).
replace
(
/
(\r\n\t
|
\n
|
\r\t)
/gm
,
""
).
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/gi
,
""
),
date
:
$
(
this
).
find
(
".td_datetime"
).
text
().
replace
(
/
(\r\n\t
|
\n
|
\r\t)
/gm
,
""
).
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/gi
,
""
),
site
:
'소프트웨어 융합대학 공지사항'
}
})
});
for
(
var
i
=
0
;
i
<
list
.
length
;
i
++
){
console
.
log
(
i
);
console
.
log
(
list
[
i
]);
list
=
list
.
filter
(
item
=>
item
.
title
);
return
list
}
async
function
loading
(){
li
=
await
getList
(
'http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1'
);
console
.
log
(
li
);
}
module
.
exports
.
loading
=
loading
;
...
...
webcrawling-practice/syncTest.js
View file @
872f61c
function
fetchItem
(){
return
new
Promise
(
function
(
resolve
,
reject
){
setTimeout
(
function
(){
resolve
();
console
.
log
(
"resolved"
);
},
3000
)
})
}
async
function
hello
(){
await
fetchItem
();
await
fetchItem
();
await
fetchItem
();
await
fetchItem
();
await
fetchItem
();
await
fetchItem
();
console
.
log
(
"resolve Complete"
)
}
hello
();
\ No newline at end of file
console
.
log
(
'2019-01-31'
<
'2019-01-01'
);
\ No newline at end of file
...
...
Please
register
or
login
to post a comment