Skip to content

Commit c84baa0

Browse files
committed
Added course > material
1 parent cd762a4 commit c84baa0

File tree

5 files changed

+1708
-93
lines changed

5 files changed

+1708
-93
lines changed

config/default.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ eventFlags:
3232
cannotConnect: { status: 'cannotConnect', code: 1 }
3333
nullValue: { status: 'nullValue', error: 2 }
3434
unknownError: { status: 'Error', code: 3 }
35+
material: #material class
36+
getContent:
37+
success: { status: 'success', code: 0 }
38+
noContent: { status: 'noContent', code: 1 }
39+
cannotConnect: { status: 'cannotConnect', code: 2 }
40+
unknownError: { status: 'Error', code: 3 }
3541

3642
course:
3743
forum:
@@ -46,7 +52,7 @@ eventFlags:
4652
cannotConnect: { status: 'cannotConnect', code: 2 }
4753
unknownError: { status: 'Error', code: 3 }
4854

49-
material:
55+
material: # course -> getMaterial
5056
success: { status: 'success', code: 0 }
5157
noMaterial: { status: 'noMaterial', code: 1 }
5258
cannotConnect: { status: 'cannotConnect', code: 2 }
@@ -70,6 +76,10 @@ selector:
7076
link: ".corner-box .content .course_list h2 @href"
7177
name: ".corner-box .content .course_list h2"
7278

79+
material:
80+
link: "* > a @href"
81+
name: "* > a"
82+
7383
course:
7484
activity:
7585
activity: "#section-2"

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const password = process.env.LMS_PASSWORD;
44
const osmosis = require('osmosis');
55
const User = require('./src/User/User');
66
const Auth = require('./src/Auth/Auth');
7+
const Material = require('./src/Course/Material');
78

89
const user = new User(username, password);
910
// const net = require('./src/Helpers/Network');
@@ -15,7 +16,8 @@ const course = new Course('https://lms.iiitb.ac.in/moodle/course/view.php?id=816
1516

1617
function onLogin(osmosis) {
1718

18-
course.getForums(osmosis)
19+
const material = new Material('https://lms.iiitb.ac.in/moodle/mod/folder/view.php?id=5905');
20+
material.getContents(osmosis)
1921
.then((res) => {
2022

2123
console.log(res);
@@ -26,15 +28,17 @@ function onLogin(osmosis) {
2628

2729
})
2830
.catch((err) => {
31+
2932
console.log(err);
33+
3034
});
3135

3236
}
3337

3438
user.login(osmosis)
3539
.then((res) => {
3640

37-
console.log(res);
41+
// console.log(res);
3842
onLogin(osmosis);
3943

4044
}, (err) => {

0 commit comments

Comments
 (0)