Toggle navigation
Toggle navigation
This project
Loading...
Sign in
HyeonJun Jeon
/
Extended-Calendar
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
박시진
2022-06-06 02:54:49 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
57e654f0371a29284912f7671c7049ad475bdb1c
57e654f0
1 parent
670d4904
[Modify]Info.subjects's type => list (to extract name of subjects)
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
server/libs/E_Campus.js
server/libs/E_Campus.js
View file @
57e654f
...
...
@@ -4,7 +4,7 @@ Info = {
id
:
"null"
,
pw
:
"null"
,
peed
:
"null"
,
subjects
:
{}
subjects
:
[]
}
function
setTimeoutPromise
(
ms
)
{
...
...
@@ -63,10 +63,6 @@ async function login(id, pw) {
Info
.
pw
=
pw
;
})
await
page
.
goto
(
"https://khcanvas.khu.ac.kr/"
);
// let currentPage = await getPeed(page);
// await getSubjects(currentPage);
// await browser.close();
// return Info;
return
page
;
}
}
catch
(
err
)
{
...
...
@@ -111,6 +107,7 @@ async function getPeed(page) {
}
async
function
getSubjects
(
page
)
{
//close the peed window to get subjects
await
page
.
click
(
'body > div:nth-child(9) > div.ui-dialog-titlebar.ui-widget-header.ui-corner-all.ui-helper-clearfix > button > span'
);
await
page
.
waitForTimeout
(
500
);
await
page
.
click
(
...
...
@@ -127,7 +124,10 @@ async function getSubjects(page) {
}
const
promise3
=
Promise
.
resolve
(
data
);
promise3
.
then
(
value
=>
{
Info
.
subjects
=
value
;
// Info.subjects = value;
for
(
let
index
=
0
;
index
<
value
.
length
;
index
++
)
{
Info
.
subjects
.
push
(
value
[
index
].
name
)
}
})
return
data
;
}
...
...
@@ -153,18 +153,12 @@ async function getOne(page, index) {
async
function
close
()
{
browser
.
close
();
}
// function that contact E_Campus
// if your account is correct, value = Promise {
// { name: '캘린더 피드를 보려면 클릭하세요.',
// link: 'https://khcanvas.khu.ac.kr/feeds/calendars/user_~~~.ics'
// }
//}
// if your account is incorrect, value = [ '', '', 'Incorrect user ID or password.' ]
exports
.
login
=
login
;
// exports.getPeed = getPeed;
// exports.getSubjects = getSubjects;
exports
.
login
=
login
;
exports
.
getPeed
=
getPeed
;
exports
.
getSubjects
=
getSubjects
;
exports
.
close
=
close
;
//console test
...
...
@@ -174,6 +168,7 @@ async function runrun() {
await
getSubjects
(
page
);
await
close
();
console
.
log
(
Info
);
console
.
log
(
Info
.
subjects
)
}
runrun
();
...
...
Please
register
or
login
to post a comment